From adb4bfa9045a93a9f3dd64a54bc50567cd92bffd Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Thu, 5 May 2022 15:29:48 +0100 Subject: [PATCH] update current_landuse_group before return in removeBuildingUserVerifiedAttribute --- app/src/api/dataAccess/verify.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/api/dataAccess/verify.ts b/app/src/api/dataAccess/verify.ts index 0be4fbd2..48bdd1c5 100644 --- a/app/src/api/dataAccess/verify.ts +++ b/app/src/api/dataAccess/verify.ts @@ -96,6 +96,15 @@ 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 @@ -106,15 +115,6 @@ export async function removeBuildingUserVerifiedAttribute(buildingId: number, us `, [buildingId, userId, attribute] ); - if (attribute == 'current_landuse_group'){ - await (db).none( - `UPDATE buildings - SET current_landuse_verified = FALSE - WHERE buildings.building_id = $1; - `, - [buildingId] - ); - } } catch(error) { throw new DatabaseError(error.detail); }