Merge pull request #833 from colouring-cities/activate-verification-2

Fix Current Use verification refresh issue
This commit is contained in:
Ed Chalstrey 2022-05-30 09:35:00 +01:00 committed by GitHub
commit 6b1129223b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 19 deletions

View File

@ -278,6 +278,9 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true, edit: true,
verify: true, verify: true,
}, },
current_landuse_verified: {
edit: true,
},
dynamics_has_demolished_buildings: { dynamics_has_demolished_buildings: {
edit: true, edit: true,
verify: true verify: true

View File

@ -74,15 +74,6 @@ export async function updateBuildingUserVerifiedAttribute(buildingId: number, us
[buildingId, userId, attribute, value] [buildingId, userId, attribute, value]
); );
} }
if (attribute == 'current_landuse_group'){
await (db).none(
`UPDATE buildings
SET current_landuse_verified = TRUE
WHERE buildings.building_id = $1;
`,
[buildingId]
);
}
} catch(error) { } catch(error) {
console.error(error) console.error(error)
if(error.detail?.includes('already exists')) { if(error.detail?.includes('already exists')) {
@ -96,15 +87,6 @@ export async function updateBuildingUserVerifiedAttribute(buildingId: number, us
export async function removeBuildingUserVerifiedAttribute(buildingId: number, userId: string, attribute: string) : Promise<null> { export async function removeBuildingUserVerifiedAttribute(buildingId: number, userId: string, attribute: string) : Promise<null> {
try { try {
if (attribute == 'current_landuse_group'){
await (db).none(
`UPDATE buildings
SET current_landuse_verified = FALSE
WHERE buildings.building_id = $1;
`,
[buildingId]
);
}
return await (db).none( return await (db).none(
`DELETE FROM `DELETE FROM
building_verification building_verification

View File

@ -247,6 +247,13 @@ const withCopyEdit: (wc: React.ComponentType<CategoryViewProps>) => DataContaine
this.setState({error: err}); this.setState({error: err});
} }
if (slug == 'current_landuse_group'){
const edits = {
'current_landuse_verified': true
};
this.doSubmit(edits);
}
console.log(slug + " verify button clicked") console.log(slug + " verify button clicked")
} }

View File

@ -220,7 +220,11 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
tooltip: "URL for current land use reference", tooltip: "URL for current land use reference",
example: ["", "", ""], example: ["", "", ""],
}, },
current_landuse_verified: {
category: Category.LandUse,
title: 'Has this land use been manually verified?',
example: true,
},
building_attachment_form: { building_attachment_form: {
category: Category.Type, category: Category.Type,
title: "Adjacency/configuration", title: "Adjacency/configuration",