Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2618 - Award Configurations - PT CSG-DEP (Award) #2728

Merged
merged 3 commits into from
Jan 26, 2024

Conversation

lewischen-aot
Copy link
Collaborator

@lewischen-aot lewischen-aot commented Jan 24, 2024

  • Updated federalAwardCSGDAmount calculation for the 3 or More Dependant stream based on above calculation
  • Updated federalAwardCSGDAmount calculation for the 2 or less Dependant stream based on above calculation, substituting limitAwardCSGD2OrLessChildAmount anywhere there is limitAwardCSGD3OrMoreChildAmount, as well as limitAwardCSGD2OrLessChildSlope for limitAwardCSGD3OrMoreChildSlope.
  • Ignored rounding in this ticket; it will be analyzed and addressed in a future ticket.
  • Added E2E tests for this story

Camunda screenshot for 3 or more dependants
Screenshot 2024-01-25 163538

Camunda screenshot for less than 3 depandents
Screenshot 2024-01-25 163730

@lewischen-aot lewischen-aot added Student Student Features Camunda Worflow Involves camunda workflow changes labels Jan 24, 2024
@lewischen-aot lewischen-aot self-assigned this Jan 24, 2024
@lewischen-aot lewischen-aot marked this pull request as ready for review January 24, 2024 23:05
@@ -504,7 +504,7 @@
<bpmn:intermediateThrowEvent id="Event_10par1m" name="calculate CSGD">
<bpmn:extensionElements>
<zeebe:ioMapping>
<zeebe:output source="= if (calculatedDataTotalFamilyIncome &#60;= dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap)&#10;then dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount&#10;else&#10; max(dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount - ((calculatedDataTotalFamilyIncome - dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap) * dmnPartTimeAwardFamilySizeVariables.limitAwardCSGD3OrMoreChildSlope),&#10; 80&#10; )" target="federalAwardCSGDAmount" />
<zeebe:output source="=min(&#10; max(&#10; if (calculatedDataTotalFamilyIncome &#60;= dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap)&#10; then &#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount&#10; else&#10; max(dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount - ((calculatedDataTotalFamilyIncome - dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap) * dmnPartTimeAwardFamilySizeVariables.limitAwardCSGD3OrMoreChildSlope),&#10; 0&#10; ) * offeringWeeks, &#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount&#10; ),&#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGDAmount&#10;)" target="federalAwardCSGDAmount" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per your description, the rounding is handled by the future ticket. Can we have the reference her as a comment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference to future ticket is commented in the story #2618.

} from "../../../test-utils/factories";
import { YesNoOptions } from "@sims/test-utils";

describe(`E2E Test Workflow parttime-assessment-${PROGRAM_YEAR}-awards-amount-CSGD for 3 or more dependants.`, () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

});
});

describe(`E2E Test Workflow parttime-assessment-${PROGRAM_YEAR}-awards-amount-CSGD for less than 3 dependants.`, () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually we have one describe for a file, I am not against it but we is this okay for the other devs? @dheepak-aot @andrewsignori-aot @andrepestana-aot @sh16011993

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say we can follow the same here mainly because, the difference between 2 describe is the data for which we have been creating just more tests and we can follow the same.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The describe should be only one and similar to the file name. The part about the dependants should be include in the it().

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test files are using only one describe now. Please have a look.

Copy link
Collaborator

@guru-aot guru-aot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor doubt, Nice work @lewischen-aot

@@ -504,7 +504,7 @@
<bpmn:intermediateThrowEvent id="Event_10par1m" name="calculate CSGD">
<bpmn:extensionElements>
<zeebe:ioMapping>
<zeebe:output source="= if (calculatedDataTotalFamilyIncome &#60;= dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap)&#10;then dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount&#10;else&#10; max(dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount - ((calculatedDataTotalFamilyIncome - dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap) * dmnPartTimeAwardFamilySizeVariables.limitAwardCSGD3OrMoreChildSlope),&#10; 80&#10; )" target="federalAwardCSGDAmount" />
<zeebe:output source="=min(&#10; max(&#10; if (calculatedDataTotalFamilyIncome &#60;= dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap)&#10; then &#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount&#10; else&#10; max(dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount - ((calculatedDataTotalFamilyIncome - dmnPartTimeAwardFamilySizeVariables.limitAwardCSGDIncomeCap) * dmnPartTimeAwardFamilySizeVariables.limitAwardCSGD3OrMoreChildSlope),&#10; 0&#10; ) * offeringWeeks, &#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGD3OrMoreChildAmount&#10; ),&#10; dmnPartTimeAwardAllowableLimits.limitAwardCSGDAmount&#10;)" target="federalAwardCSGDAmount" />
Copy link
Collaborator

@dheepak-aot dheepak-aot Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO When I saw the weekly amount is written as large expression, I felt we can create a variable to get the weekly amount calculated first and use here.

image

image

@andrewsignori-aot @guru-aot @andrepestana-aot thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe creating a variable for the Weekly Amount is better. It can be reused if required.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea to make it more readable with the new variable.

Copy link
Collaborator Author

@lewischen-aot lewischen-aot Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've verified with @CarlyCotton that multiplying offeringWeeks only takes place for the else statement. The logic is the same, and I've updated the code for better readability. I've updated the screenshots in the description.

Screenshot 2024-01-25 163730

Please let me know if we want to move on to creating a new variable for calculating the nested if else statement. @dheepak-aot @guru-aot @andrepestana-aot @andrewsignori-aot @sh16011993

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would agree that the code is a bit hard to read while in Camunda and when I copied and pasted it into VS Code was still a good amount of horizontal code. Either way, I would not invest time in creating more variables at this time since it came from business and I believe that was clear for them for now.

Copy link
Collaborator

@dheepak-aot dheepak-aot Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @lewischen-aot I missed that multiplying offering weeks is only part of else.

calculatedAssessment.variables.dmnPartTimeAwardFamilySizeVariables
.limitAwardCSGDIncomeCap,
);
const offeringWeeksAmount =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we not trying to assert federalAwardCSGDAmount here.? and same everywhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. It is now asserting federalAwardCSGDAmount in the latest commit. Please have a look.

@dheepak-aot
Copy link
Collaborator

Nice work @lewischen-aot . Please have a look at the comments.

Copy link
Collaborator

@andrepestana-aot andrepestana-aot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job. Please take a look at the other devs' comments.

…ed offeringweeks calculation in e2e tests and modified camunda indentation for better readability
@lewischen-aot lewischen-aot force-pushed the feature/#2618-ac-pt-csg-dep-award branch from 34ce108 to 8b96a8b Compare January 26, 2024 00:50
);
});

it("Should determine federalAwardCSGDAmount for less than 3 dependants and calculatedDataTotalFamilyIncome <= limitAwardCSGDIncomeCap", async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the tests testing less than three dependents, should we not consider adding at least one dependent to the studentDataDependants in at least one of the scenarios?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't add it in the first place because it didn't change the result very much, but I added one dependent for less than 3 dependents scenario in my latest commit to complete the dependents scenarios.

calculatedAssessment.variables.dmnPartTimeAwardFamilySizeVariables
.limitAwardCSGDIncomeCap,
);
const nestedCalculation = Math.max(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment outside the PR and for the future, I have been seeing this logic in the asserts trying to replicate in some way the logic in the workflow. I would recommend that when we have more control over all the data we should try to assert the values in the E2E in a more hard-coded way.
@dheepak-aot @andrepestana-aot @guru-aot @sh16011993 thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. we should not re-write the logic for assertion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree too. We should assert hard-coded values instead of the logic.

Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work and thanks for adding the E2E tests. Left just some minor comments, hence approving it.

Copy link
Collaborator

@guru-aot guru-aot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice work @lewischen-aot

Copy link
Collaborator

@dheepak-aot dheepak-aot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing the changes 👍

Copy link

sonarcloud bot commented Jan 26, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 19.57% ( 2667 / 13625 )
Methods: 10.38% ( 180 / 1734 )
Lines: 22.22% ( 2293 / 10321 )
Branches: 12.36% ( 194 / 1570 )

Copy link

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 51.87% ( 360 / 694 )
Methods: 46.15% ( 42 / 91 )
Lines: 56.52% ( 299 / 529 )
Branches: 25.68% ( 19 / 74 )

Copy link

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 78.26% ( 673 / 860 )
Methods: 71.84% ( 74 / 103 )
Lines: 79.97% ( 587 / 734 )
Branches: 52.17% ( 12 / 23 )

Copy link

E2E SIMS API Coverage Report

Totals Coverage
Statements: 55.33% ( 4139 / 7480 )
Methods: 52.14% ( 511 / 980 )
Lines: 60% ( 3348 / 5580 )
Branches: 30.43% ( 280 / 920 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Camunda Worflow Involves camunda workflow changes Student Student Features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants