Skip to content

Commit

Permalink
Merge pull request #3610 from bcgov/NDT-541-Split-the-CCBC-requested-…
Browse files Browse the repository at this point in the history
…50-50-for-ISED-and-BC-funding-requested-Application

feat: split funding for ccbc summary (application)
  • Loading branch information
ccbc-service-account authored Oct 18, 2024
2 parents 179f944 + f01032d commit 91e2eaa
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
26 changes: 24 additions & 2 deletions app/lib/helpers/ccbcSummaryGenerateFormData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -322,6 +335,10 @@ const getFormDataFromApplication = (
economicRegions,
regionalDistricts
) => {
const splitFunding = handleSplitFunding(
applicationData?.formData?.jsonData?.projectFunding
?.totalFundingRequestedCCBC
);
return {
formData: {
counts: {
Expand All @@ -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,
Expand Down Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions db/sqitch.plan
Original file line number Diff line number Diff line change
Expand Up @@ -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 ,,, <ryohani89@NH504670> # Remove pre-cut-over cbc changes history
@1.197.4 2024-10-17T17:46:23Z CCBC Service Account <[email protected]> # release v1.197.4
@1.197.5 2024-10-17T18:43:02Z CCBC Service Account <[email protected]> # release v1.197.5
@1.198.0 2024-10-18T16:12:02Z CCBC Service Account <[email protected]> # release v1.198.0
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
Expand Down

0 comments on commit 91e2eaa

Please sign in to comment.