From 42b37fabf682b4c36d63f2de2de1186a4c9dabe8 Mon Sep 17 00:00:00 2001 From: Rafael Solorzano <61289255+rafasdc@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:53:40 -0700 Subject: [PATCH 1/2] feat: split funding for ccbc summary (application) --- .../helpers/ccbcSummaryGenerateFormData.tsx | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/app/lib/helpers/ccbcSummaryGenerateFormData.tsx b/app/lib/helpers/ccbcSummaryGenerateFormData.tsx index db159fc62..669b573b9 100644 --- a/app/lib/helpers/ccbcSummaryGenerateFormData.tsx +++ b/app/lib/helpers/ccbcSummaryGenerateFormData.tsx @@ -268,6 +268,19 @@ const getSowData = (sowData, baseSowData) => { }; }; +const handleSplitFunding = (requestedFunding) => { + if (!requestedFunding) { + return { bc: null, federal: null }; + } + const halfAmount = requestedFunding / 2; + + // Rounding up for bc and down for federal + const bc = Math.ceil(halfAmount); + const federal = Math.floor(halfAmount); + + return { bc, federal }; +}; + const sumConditionalApprovalFunding = ( bcFundingRequested, isedFundingRequested @@ -322,6 +335,10 @@ const getFormDataFromApplication = ( economicRegions, regionalDistricts ) => { + const splitFunding = handleSplitFunding( + applicationData?.formData?.jsonData?.projectFunding + ?.totalFundingRequestedCCBC + ); return { formData: { counts: { @@ -341,8 +358,8 @@ const getFormDataFromApplication = ( regionalDistricts: getRegionalDistricts(regionalDistricts), }, funding: { - bcFundingRequested: null, - federalFunding: null, + bcFundingRequested: splitFunding?.bc, + federalFunding: splitFunding?.federal, fundingRequestedCcbc: applicationData?.formData?.jsonData?.projectFunding ?.totalFundingRequestedCCBC, @@ -375,6 +392,11 @@ const getFormDataFromApplication = ( }, }, formDataSource: { + bcFundingRequested: + splitFunding?.bc && 'Calculated from Application, assuming 50:50 split', + federalFunding: + splitFunding?.federal && + 'Calculated from Application, assuming 50:50 split', totalHouseholdsImpacted: 'Application', numberOfIndigenousHouseholds: 'Application', applicantAmount: 'Application', From f01032d5774874b1f0e16ca5e025e8281cb7e9bb Mon Sep 17 00:00:00 2001 From: CCBC Service Account <116113628+ccbc-service-account@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:12:04 +0000 Subject: [PATCH 2/2] chore: release v1.198.0 --- CHANGELOG.md | 6 ++++++ db/sqitch.plan | 1 + package.json | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c81db0de3..80b4cda4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# [1.198.0](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.197.5...v1.198.0) (2024-10-18) + +### Features + +- split funding for ccbc summary (application) ([42b37fa](https://github.com/bcgov/CONN-CCBC-portal/commit/42b37fabf682b4c36d63f2de2de1186a4c9dabe8)) + ## [1.197.5](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.197.4...v1.197.5) (2024-10-17) ## [1.197.4](https://github.com/bcgov/CONN-CCBC-portal/compare/v1.197.3...v1.197.4) (2024-10-17) diff --git a/db/sqitch.plan b/db/sqitch.plan index 08dff5f46..87a444f66 100644 --- a/db/sqitch.plan +++ b/db/sqitch.plan @@ -706,3 +706,4 @@ tables/application_rd 2024-09-11T18:21:13Z Rafael Solorzano <61289255+rafasdc@us clean_pre_cut_over_cbc_history 2024-10-15T23:26:47Z ,,, # Remove pre-cut-over cbc changes history @1.197.4 2024-10-17T17:46:23Z CCBC Service Account # release v1.197.4 @1.197.5 2024-10-17T18:43:02Z CCBC Service Account # release v1.197.5 +@1.198.0 2024-10-18T16:12:02Z CCBC Service Account # release v1.198.0 diff --git a/package.json b/package.json index c4cb3e606..c1ee8a203 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "CONN-CCBC-portal", - "version": "1.197.5", + "version": "1.198.0", "main": "index.js", "repository": "https://github.com/bcgov/CONN-CCBC-portal.git", "author": "Romer, Meherzad CITZ:EX ",