Skip to content

Commit

Permalink
#4397 - Fix CSGD (CSG - PTDEP) [PT 24/25] (#4399)
Browse files Browse the repository at this point in the history
### As a part of this PR, the following was fixed:

- Updated the name of the calculation in the <=2 or 3+ paths from
`federalAwardCSGDAmount` to `federalAwardMaxCSGDAmount`

**Screenshot:**


![image](https://github.com/user-attachments/assets/eff80202-cb2c-4f6f-97d0-ba12227d245f)


--------------------------------------------------------------------------------------------------------------

- Updated the `federalAwardNetCSGDAmount` calculation to take the
minimum value of remaining need, max calculated, and PY award limit less
previously awarded value.

**Screenshot:**


![image](https://github.com/user-attachments/assets/f2686235-e568-4706-a3fc-7d55f8f36fb5)


--------------------------------------------------------------------------------------------------------------

- Fixed the e2e tests

**Screenshot:**

<img width="1486" alt="image"
src="https://github.com/user-attachments/assets/6ca62a6a-d576-4ef5-91b6-e7adbe8ece7b"
/>
  • Loading branch information
sh16011993 authored Feb 26, 2025
2 parents efd8bec + 32b2ef6 commit 28992e0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ dmnX (comes from dmn)</bpmn:text>
<bpmn:intermediateThrowEvent id="Event_1iix0z3" name="calculate CSGD total limit">
<bpmn:extensionElements>
<zeebe:ioMapping>
<zeebe:output source="=min(&#10; max(&#10; if (calculatedDataTotalFamilyIncome &#60;= dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap)&#10; then &#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGD2OrLessChildAmount * offeringWeeks&#10; else&#10; max(dmnPartTimeAwardAllowableLimits.limitAwardCSGD2OrLessChildAmount - ((calculatedDataTotalFamilyIncome - dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap) * dmnPartTimeAwardFamilySizeVariables.limitAwardCSGD2OrLessChildSlope), 0) * offeringWeeks&#10; ,&#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGD2OrLessChildAmount&#10; ),&#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGDAmount&#10;)" target="federalAwardCSGDAmount" />
<zeebe:output source="=min(&#10; max(&#10; if (calculatedDataTotalFamilyIncome &#60;= dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap)&#10; then &#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGD2OrLessChildAmount * offeringWeeks&#10; else&#10; max(dmnPartTimeAwardAllowableLimits.limitAwardCSGD2OrLessChildAmount - ((calculatedDataTotalFamilyIncome - dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap) * dmnPartTimeAwardFamilySizeVariables.limitAwardCSGD2OrLessChildSlope), 0) * offeringWeeks&#10; ,&#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGD2OrLessChildAmount&#10; ),&#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGDAmount&#10;)" target="federalAwardMaxCSGDAmount" />
</zeebe:ioMapping>
</bpmn:extensionElements>
<bpmn:incoming>Flow_1lswqbt</bpmn:incoming>
Expand All @@ -706,7 +706,7 @@ dmnX (comes from dmn)</bpmn:text>
<bpmn:intermediateThrowEvent id="Event_10par1m" name="calculate CSGD total limit">
<bpmn:extensionElements>
<zeebe:ioMapping>
<zeebe:output source="=min(&#10; max(&#10; if (calculatedDataTotalFamilyIncome &#60;= dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap)&#10; then &#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount * offeringWeeks&#10; else&#10; max(dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount - ((calculatedDataTotalFamilyIncome - dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap) * dmnPartTimeAwardFamilySizeVariables.limitAwardCSGD3OrMoreChildSlope), 0) * offeringWeeks&#10; ,&#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount&#10; ),&#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGDAmount&#10;)" target="federalAwardCSGDAmount" />
<zeebe:output source="=min(&#10; max(&#10; if (calculatedDataTotalFamilyIncome &#60;= dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap)&#10; then &#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount * offeringWeeks&#10; else&#10; max(dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount - ((calculatedDataTotalFamilyIncome - dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap) * dmnPartTimeAwardFamilySizeVariables.limitAwardCSGD3OrMoreChildSlope), 0) * offeringWeeks&#10; ,&#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount&#10; ),&#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGDAmount&#10;)" target="federalAwardMaxCSGDAmount" />
</zeebe:ioMapping>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0luqxk1</bpmn:incoming>
Expand All @@ -732,7 +732,7 @@ dmnX (comes from dmn)</bpmn:text>
<bpmn:intermediateThrowEvent id="Event_1eaa23y" name="calculate CSGD">
<bpmn:extensionElements>
<zeebe:ioMapping>
<zeebe:output source="=//Deduct the total CSGD consumed amount for current Program Year from the derived CSGD total limit.&#10;if (awardEligibilityCSGD = true)&#10;then&#10; max(min(calculatedDataTotalRemainingNeed2, federalAwardCSGDAmount - programYearTotalPartTimeCSGD),0)&#10;else&#10;0" target="federalAwardNetCSGDAmount" />
<zeebe:output source="=//Deduct the total CSGD consumed amount for current Program Year from the derived CSGD total limit.&#10;if (awardEligibilityCSGD = true)&#10;then&#10; max(min(calculatedDataTotalRemainingNeed2, federalAwardMaxCSGDAmount, dmnPartTimeAwardAllowableLimits.limitAwardCSGDAmount-programYearTotalPartTimeCSGD),0)&#10;else&#10;0" target="federalAwardNetCSGDAmount" />
<zeebe:output source="=max(0,(calculatedDataTotalRemainingNeed2 - federalAwardNetCSGDAmount))" target="calculatedDataTotalRemainingNeed3" />
</zeebe:ioMapping>
</bpmn:extensionElements>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe(`E2E Test Workflow parttime-assessment-${PROGRAM_YEAR}-awards-amount-CS
calculatedAssessment.variables.dmnPartTimeAwardFamilySizeVariables
.limitAwardCSGDIncomeCap,
);
expect(calculatedAssessment.variables.federalAwardCSGDAmount).toBe(1260);
expect(calculatedAssessment.variables.federalAwardNetCSGDAmount).toBe(1260);
});

it("Should determine federalAwardCSGDAmount for 3 or more dependants and calculatedDataTotalFamilyIncome > limitAwardCSGDIncomeCap", async () => {
Expand Down Expand Up @@ -114,7 +114,7 @@ describe(`E2E Test Workflow parttime-assessment-${PROGRAM_YEAR}-awards-amount-CS
);
expect(
Math.round(
calculatedAssessment.variables.federalAwardCSGDAmount * 10000,
calculatedAssessment.variables.federalAwardMaxCSGDAmount * 10000,
) / 10000,
).toBe(
Math.min(
Expand All @@ -124,10 +124,10 @@ describe(`E2E Test Workflow parttime-assessment-${PROGRAM_YEAR}-awards-amount-CS
),
);
expect(calculatedAssessment.variables.federalAwardNetCSGDAmount).toBe(
1021.455424,
1221.455424,
);
expect(calculatedAssessment.variables.finalFederalAwardNetCSGDAmount).toBe(
1021.455424,
1221.455424,
);
});

Expand Down Expand Up @@ -172,7 +172,7 @@ describe(`E2E Test Workflow parttime-assessment-${PROGRAM_YEAR}-awards-amount-CS
calculatedAssessment.variables.dmnPartTimeAwardFamilySizeVariables
.limitAwardCSGDIncomeCap,
);
expect(calculatedAssessment.variables.federalAwardCSGDAmount).toBe(840);
expect(calculatedAssessment.variables.federalAwardMaxCSGDAmount).toBe(840);
});

it("Should determine federalAwardCSGDAmount for less than 3 dependants and calculatedDataTotalFamilyIncome > limitAwardCSGDIncomeCap", async () => {
Expand Down Expand Up @@ -227,7 +227,7 @@ describe(`E2E Test Workflow parttime-assessment-${PROGRAM_YEAR}-awards-amount-CS
);
expect(
Math.round(
calculatedAssessment.variables.federalAwardCSGDAmount * 10000,
calculatedAssessment.variables.federalAwardMaxCSGDAmount * 10000,
) / 10000,
).toBe(
Math.min(
Expand All @@ -237,10 +237,10 @@ describe(`E2E Test Workflow parttime-assessment-${PROGRAM_YEAR}-awards-amount-CS
),
);
expect(calculatedAssessment.variables.federalAwardNetCSGDAmount).toBe(
536.5661968,
736.5661968,
);
expect(calculatedAssessment.variables.finalFederalAwardNetCSGDAmount).toBe(
536.5661968,
736.5661968,
);
});

Expand Down Expand Up @@ -270,7 +270,7 @@ describe(`E2E Test Workflow parttime-assessment-${PROGRAM_YEAR}-awards-amount-CS
// calculatedDataTotalFamilyIncome <= limitAwardCSGDIncomeCap
// federalAwardCSGDAmount
expect(calculatedAssessment.variables.awardEligibilityCSGD).toBe(true);
expect(calculatedAssessment.variables.federalAwardCSGDAmount).toBe(
expect(calculatedAssessment.variables.federalAwardMaxCSGDAmount).toBe(
736.5661968,
);
expect(calculatedAssessment.variables.federalAwardNetCSGDAmount).toBe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ export interface CalculatedAssessmentModel {
provincialAwardNetCSGPAmount: number;
// CSGD
federalAwardCSGDAmount: number;
federalAwardMaxCSGDAmount: number;
federalAwardNetCSGDAmount: number;
provincialAwardNetCSGDAmount: number;
// CSGF
Expand Down

0 comments on commit 28992e0

Please sign in to comment.