From 5ec9f2f9bf3c917aceb4a5fcb46cb634729d8c8e Mon Sep 17 00:00:00 2001 From: Courtney Myers Date: Wed, 27 Nov 2024 09:00:07 -0500 Subject: [PATCH] Update server app's parsing of 2024 FRF data in fetchDataForPRFSubmission() to account for updated structure of 2024 FRF --- app/server/app/utilities/formio.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/app/server/app/utilities/formio.js b/app/server/app/utilities/formio.js index 9ea67158..0a4235fd 100644 --- a/app/server/app/utilities/formio.js +++ b/app/server/app/utilities/formio.js @@ -552,16 +552,20 @@ function fetchDataForPRFSubmission({ rebateYear, req, res }) { County__c, } = Account || {}; - const jsonOrg = frf2024RecordJson.data.organizations.find((org) => { - const matchedName = org?.org_orgName?.trim() === orgName?.trim(); - const matchedEmail = - org.org_contactEmail?.trim()?.toLowerCase() === - Email?.trim()?.toLowerCase(); - - return matchedName && matchedEmail; - }); - - const orgAlreadyAdded = array.some((org) => org._org_id === orgId); + const jsonOrg = frf2024RecordJson.data.org_organizations.find( + (org) => { + const matchedName = org?.org_name?.trim() === orgName?.trim(); + const matchedEmail = + org.org_contact_email?.trim()?.toLowerCase() === + Email?.trim()?.toLowerCase(); + + return matchedName && matchedEmail; + }, + ); + + const orgAlreadyAdded = array.some( + (org) => org._bap_org_id === orgId, + ); /** * Ensure the org exists in the 2024 FRF submission's