From a5259fed35f63a2938def1a6128c9f1182a181a7 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Thu, 26 May 2022 15:33:11 +0100 Subject: [PATCH 1/6] Revert "finish removing current use verification changes" This reverts commit 1bfcc0682b9acfac40b1a293c03554d6076afb44. --- app/src/frontend/building/data-components/year-data-entry.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/frontend/building/data-components/year-data-entry.tsx b/app/src/frontend/building/data-components/year-data-entry.tsx index aea54267..af0d0749 100644 --- a/app/src/frontend/building/data-components/year-data-entry.tsx +++ b/app/src/frontend/building/data-components/year-data-entry.tsx @@ -20,13 +20,13 @@ interface YearDataEntryProps { verified_count: number; allow_verify: boolean; - onVerify_upper: (slug: string, verify: boolean, x: number, y: number) => void; + onVerify_upper: (slug: string, verify: boolean, x: number, y: number, value: any) => void; user_verified_upper: boolean; user_verified_as_upper: string; verified_count_upper: number; allow_verify_upper: boolean; - onVerify_lower: (slug: string, verify: boolean, x: number, y: number) => void; + onVerify_lower: (slug: string, verify: boolean, x: number, y: number, value: any) => void; user_verified_lower: boolean; user_verified_as_lower: string; verified_count_lower: number; From 1d9b3bef13b449c03f96fa7d1ce7fdcac6cc329c Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Thu, 26 May 2022 15:33:38 +0100 Subject: [PATCH 2/6] Revert "remove changes related to Current Use verification button" This reverts commit ed5cd0b9fae1ecbc9ff0d47a69e51af650a9422d. --- app/src/frontend/building/data-components/verification.tsx | 5 +++-- .../frontend/building/data-components/year-data-entry.tsx | 2 +- app/src/frontend/building/data-container.tsx | 2 +- .../building/data-containers/category-view-props.ts | 2 +- app/src/frontend/config/data-fields-config.ts | 6 +++++- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/frontend/building/data-components/verification.tsx b/app/src/frontend/building/data-components/verification.tsx index 009a95f1..f0591cce 100644 --- a/app/src/frontend/building/data-components/verification.tsx +++ b/app/src/frontend/building/data-components/verification.tsx @@ -5,7 +5,7 @@ import './verification.css'; interface VerificationProps { slug: string; - onVerify: (slug: string, verify: boolean, x: number, y: number) => void; + onVerify: (slug: string, verify: boolean, x: number, y: number, value: any) => void; user_verified: boolean; user_verified_as: string; verified_count: number; @@ -24,7 +24,8 @@ class Verification extends Component { e.preventDefault(); const x = e.clientX / document.body.clientWidth; const y = e.clientY / document.body.clientHeight; - this.props.onVerify(this.props.slug, verify, x, y); + const value = null; + this.props.onVerify(this.props.slug, verify, x, y, value); } } diff --git a/app/src/frontend/building/data-components/year-data-entry.tsx b/app/src/frontend/building/data-components/year-data-entry.tsx index af0d0749..dfc93cb3 100644 --- a/app/src/frontend/building/data-components/year-data-entry.tsx +++ b/app/src/frontend/building/data-components/year-data-entry.tsx @@ -14,7 +14,7 @@ interface YearDataEntryProps { mode?: 'view' | 'edit' | 'multi-edit'; onChange?: (key: string, value: any) => void; - onVerify: (slug: string, verify: boolean, x: number, y: number) => void; + onVerify: (slug: string, verify: boolean, x: number, y: number, value: any) => void; user_verified: boolean; user_verified_as: string; verified_count: number; diff --git a/app/src/frontend/building/data-container.tsx b/app/src/frontend/building/data-container.tsx index fb886d7a..2df3c222 100644 --- a/app/src/frontend/building/data-container.tsx +++ b/app/src/frontend/building/data-container.tsx @@ -214,7 +214,7 @@ const withCopyEdit: (wc: React.ComponentType) => DataContaine this.doSubmit(edits); } - async handleVerify(slug: string, verify: boolean, x: number, y: number) { + async handleVerify(slug: string, verify: boolean, x: number, y: number, value: any) { const verifyPatch = {}; if (verify) { verifyPatch[slug] = this.props.building[slug]; diff --git a/app/src/frontend/building/data-containers/category-view-props.ts b/app/src/frontend/building/data-containers/category-view-props.ts index 27d510f6..d6188864 100644 --- a/app/src/frontend/building/data-containers/category-view-props.ts +++ b/app/src/frontend/building/data-containers/category-view-props.ts @@ -14,7 +14,7 @@ interface CategoryViewProps { edited: boolean; copy: CopyProps; onChange: (key: string, value: any) => void; - onVerify: (slug: string, verify: boolean, x: number, y: number) => void; + onVerify: (slug: string, verify: boolean, x: number, y: number, value: any) => void; /* Special handler for adding and immediately saving a new item of an array-like attribute */ onSaveAdd: (slug: string, newItem: any) => void; diff --git a/app/src/frontend/config/data-fields-config.ts b/app/src/frontend/config/data-fields-config.ts index f808f000..95a46238 100644 --- a/app/src/frontend/config/data-fields-config.ts +++ b/app/src/frontend/config/data-fields-config.ts @@ -220,7 +220,11 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ tooltip: "URL for current land use reference", example: ["", "", ""], }, - + current_landuse_verified: { + category: Category.LandUse, + title: 'Has this land use been manually verified?', + example: true, + }, building_attachment_form: { category: Category.Type, title: "Adjacency/configuration", From 30774e2a24b14967792b8f7fd6b60494a82f958a Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Fri, 27 May 2022 11:22:42 +0100 Subject: [PATCH 3/6] remove changes to onVerify --- app/src/frontend/building/data-components/verification.tsx | 5 ++--- .../frontend/building/data-components/year-data-entry.tsx | 6 +++--- app/src/frontend/building/data-container.tsx | 2 +- .../building/data-containers/category-view-props.ts | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/src/frontend/building/data-components/verification.tsx b/app/src/frontend/building/data-components/verification.tsx index f0591cce..009a95f1 100644 --- a/app/src/frontend/building/data-components/verification.tsx +++ b/app/src/frontend/building/data-components/verification.tsx @@ -5,7 +5,7 @@ import './verification.css'; interface VerificationProps { slug: string; - onVerify: (slug: string, verify: boolean, x: number, y: number, value: any) => void; + onVerify: (slug: string, verify: boolean, x: number, y: number) => void; user_verified: boolean; user_verified_as: string; verified_count: number; @@ -24,8 +24,7 @@ class Verification extends Component { e.preventDefault(); const x = e.clientX / document.body.clientWidth; const y = e.clientY / document.body.clientHeight; - const value = null; - this.props.onVerify(this.props.slug, verify, x, y, value); + this.props.onVerify(this.props.slug, verify, x, y); } } diff --git a/app/src/frontend/building/data-components/year-data-entry.tsx b/app/src/frontend/building/data-components/year-data-entry.tsx index dfc93cb3..aea54267 100644 --- a/app/src/frontend/building/data-components/year-data-entry.tsx +++ b/app/src/frontend/building/data-components/year-data-entry.tsx @@ -14,19 +14,19 @@ interface YearDataEntryProps { mode?: 'view' | 'edit' | 'multi-edit'; onChange?: (key: string, value: any) => void; - onVerify: (slug: string, verify: boolean, x: number, y: number, value: any) => void; + onVerify: (slug: string, verify: boolean, x: number, y: number) => void; user_verified: boolean; user_verified_as: string; verified_count: number; allow_verify: boolean; - onVerify_upper: (slug: string, verify: boolean, x: number, y: number, value: any) => void; + onVerify_upper: (slug: string, verify: boolean, x: number, y: number) => void; user_verified_upper: boolean; user_verified_as_upper: string; verified_count_upper: number; allow_verify_upper: boolean; - onVerify_lower: (slug: string, verify: boolean, x: number, y: number, value: any) => void; + onVerify_lower: (slug: string, verify: boolean, x: number, y: number) => void; user_verified_lower: boolean; user_verified_as_lower: string; verified_count_lower: number; diff --git a/app/src/frontend/building/data-container.tsx b/app/src/frontend/building/data-container.tsx index 2df3c222..fb886d7a 100644 --- a/app/src/frontend/building/data-container.tsx +++ b/app/src/frontend/building/data-container.tsx @@ -214,7 +214,7 @@ const withCopyEdit: (wc: React.ComponentType) => DataContaine this.doSubmit(edits); } - async handleVerify(slug: string, verify: boolean, x: number, y: number, value: any) { + async handleVerify(slug: string, verify: boolean, x: number, y: number) { const verifyPatch = {}; if (verify) { verifyPatch[slug] = this.props.building[slug]; diff --git a/app/src/frontend/building/data-containers/category-view-props.ts b/app/src/frontend/building/data-containers/category-view-props.ts index d6188864..27d510f6 100644 --- a/app/src/frontend/building/data-containers/category-view-props.ts +++ b/app/src/frontend/building/data-containers/category-view-props.ts @@ -14,7 +14,7 @@ interface CategoryViewProps { edited: boolean; copy: CopyProps; onChange: (key: string, value: any) => void; - onVerify: (slug: string, verify: boolean, x: number, y: number, value: any) => void; + onVerify: (slug: string, verify: boolean, x: number, y: number) => void; /* Special handler for adding and immediately saving a new item of an array-like attribute */ onSaveAdd: (slug: string, newItem: any) => void; From cb3d51ceca36c43b0d1fe71fe2a5fb330a1d822a Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Fri, 27 May 2022 11:30:48 +0100 Subject: [PATCH 4/6] 'current_landuse_verified': true when slug == 'current_landuse_group' --- app/src/frontend/building/data-container.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/frontend/building/data-container.tsx b/app/src/frontend/building/data-container.tsx index fb886d7a..1d47c3bd 100644 --- a/app/src/frontend/building/data-container.tsx +++ b/app/src/frontend/building/data-container.tsx @@ -247,6 +247,13 @@ const withCopyEdit: (wc: React.ComponentType) => DataContaine this.setState({error: err}); } + if (slug == 'current_landuse_group'){ + const edits = { + 'current_landuse_verified': true + }; + + this.doSubmit(edits); + } console.log(slug + " verify button clicked") } From 14129abb923cd49f2c8ed991b8a5f5234ca9532e Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Fri, 27 May 2022 14:41:04 +0100 Subject: [PATCH 5/6] allow current_landuse_verified --- app/src/api/config/dataFields.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/api/config/dataFields.ts b/app/src/api/config/dataFields.ts index 5e1f6474..146ae8d5 100644 --- a/app/src/api/config/dataFields.ts +++ b/app/src/api/config/dataFields.ts @@ -278,6 +278,9 @@ export const buildingAttributesConfig = valueType()({ /* eslint edit: true, verify: true, }, + current_landuse_verified: { + edit: true, + }, dynamics_has_demolished_buildings: { edit: true, verify: true From fff8a1bc92ba737079588173343191e0b2e78b22 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Fri, 27 May 2022 14:51:31 +0100 Subject: [PATCH 6/6] remove backend verification field change --- app/src/api/dataAccess/verify.ts | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/app/src/api/dataAccess/verify.ts b/app/src/api/dataAccess/verify.ts index 48bdd1c5..02e163d7 100644 --- a/app/src/api/dataAccess/verify.ts +++ b/app/src/api/dataAccess/verify.ts @@ -74,15 +74,6 @@ export async function updateBuildingUserVerifiedAttribute(buildingId: number, us [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) { console.error(error) 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 { 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( `DELETE FROM building_verification