From 657f098afd5314e15d070abb0be32fb10259b439 Mon Sep 17 00:00:00 2001 From: Brijesh Date: Tue, 12 Nov 2024 09:31:07 -0800 Subject: [PATCH] remove status 21 from the list to identify amendment approver --- src/libs/db2/model/plansnapshot.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libs/db2/model/plansnapshot.js b/src/libs/db2/model/plansnapshot.js index 7c7fc916..4f4553b0 100644 --- a/src/libs/db2/model/plansnapshot.js +++ b/src/libs/db2/model/plansnapshot.js @@ -143,7 +143,7 @@ export default class PlanSnapshot extends Model { snapshot: row.snapshot, }); } - if (Plan.legalStatuses.indexOf(row.status_id) !== -1) { + if ([20, 8, 9, 12].indexOf(row.status_id) !== -1) { if (lastMandatoryAmendment !== null) { response[lastMandatoryAmendment].approvedBy = `${row.given_name} ${row.family_name}`; response[lastMandatoryAmendment].approvedAt = row.created_at; @@ -153,12 +153,13 @@ export default class PlanSnapshot extends Model { } } } - const responseReversed = response.reverse(); - const currentLegalVersion = responseReversed.find( + const responseSorted = response.reverse(); + + const currentLegalVersion = responseSorted.find( (resp) => Plan.legalStatuses.indexOf(resp.snapshot.statusId) !== -1, ); if (currentLegalVersion) currentLegalVersion.isCurrentLegalVersion = true; - return responseReversed; + return responseSorted; } async fetchStatus(db) {