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

#3453 - COE for $0/Not Eligible Assessments - Part 1 #4010

Merged
merged 6 commits into from
Dec 3, 2024

Conversation

lewischen-aot
Copy link
Collaborator

@lewischen-aot lewischen-aot commented Nov 28, 2024

The first part of the PR resolves the following business AC:

  • Do not show $0/Ineligible disbursements to Institution users, even if COE is "Required"

The PR includes the changes for two modules: API endpoint and workers.

  • Created a new flag has_estimated_awards in the disbursement table to indicate the $0 disbursement during the saving assessments in the workers.
  • Added method updateDisbursementsHasEstimatedAwards to update has_estimated_awards for each disbursement in the method saveAssessmentData.
  • Added new E2E test case for the institution API endpoint getCOESummary
    • "Should get the count of COE current summary as zero when there is 1 COE that doesn't have estimated awards."

Rollback Evidence

image

SQL query to run on Production as required from comment

UPDATE
    sims.disbursement_schedules
SET
    has_estimated_awards = CASE
        WHEN disbursement_total_amounts.value_amount > 0 THEN true
        ELSE false
    END
FROM
    (
        SELECT
            disbursement_value.disbursement_schedule_id AS disbursement_schedule_id,
            sum(disbursement_value.value_amount) AS value_amount
        FROM
            sims.disbursement_values disbursement_value
        GROUP BY
            disbursement_value.disbursement_schedule_id
    ) disbursement_total_amounts
WHERE
    sims.disbursement_schedules.id = disbursement_total_amounts.disbursement_schedule_id;

The next part will cover the changes for another two modules: COE Request report and e-Cert queue consumer.

@lewischen-aot lewischen-aot added Institution Institution Features SIMS-Api SIMS-Api Camunda Workers DB DB migration involved labels Nov 28, 2024
@lewischen-aot lewischen-aot self-assigned this Nov 28, 2024
@lewischen-aot lewischen-aot marked this pull request as ready for review November 28, 2024 18:12
Copy link
Collaborator

@sh16011993 sh16011993 left a comment

Choose a reason for hiding this comment

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

Everything looks good. Just one question regarding the changes in the e2e test file.

@dheepak-aot
Copy link
Collaborator

dheepak-aot commented Nov 29, 2024

Nice start @lewischen-aot . Please have a look into the comments.

One question. Is ECE integration going to part of next PR?

INNER JOIN sims.disbursement_values disbursement_values ON disbursement_values.disbursement_schedule_id = disbursement_schedules.id
GROUP BY
disbursement_schedules.id
) disbursement_total_amounts
Copy link
Collaborator

@dheepak-aot dheepak-aot Dec 3, 2024

Choose a reason for hiding this comment

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

As a suggestion, I would recommend the following UPDATE SQL considering less complex to read and understand IMO.

But it is not a blocker. Existing update still does the work.

update
	sims.disbursement_schedules
set
	has_estimated_awards = (case
		when exists (
	select
			1
	from
			sims.disbursement_values disbursement_value
	where
			disbursement_value.disbursement_schedule_id = sims.disbursement_schedules.id
		and disbursement_value.value_amount > 0) then true
	else false
end);

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 query. I updated this query in this commit, but sonarcloud quality gate failed.
image
image
image
I am reverting it back with the update in this comment.

Comment on lines +81 to +86
await db.notificationMessage.update(
{
id: NotificationMessageType.MinistryNotificationDisbursementBlocked,
},
{ emailContacts: ["[email protected]"] },
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Asking for my understanding. Was this required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Shashank asked the same question, and I replied in his comment: here.

@dheepak-aot
Copy link
Collaborator

Thanks for making the changes and writing extensive E2E tests. Added more comments. Please have a look.

},
],
});
const saveResult = await disbursementController.saveDisbursementSchedules(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor. Add the //Act comment before line 394.

image

fakeOriginalAssessment,
);

// Act
Copy link
Collaborator

Choose a reason for hiding this comment

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

The act comment must be right before line 471.

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 making the changes and also taking effort to split the PRs.
Approved with 2 minor comments.

Please feel free to merge once the 2 minor comments are addressed.

Copy link

sonarqubecloud bot commented Dec 3, 2024

Copy link

github-actions bot commented Dec 3, 2024

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 21.99% ( 3742 / 17018 )
Methods: 10.08% ( 214 / 2124 )
Lines: 25.33% ( 3250 / 12833 )
Branches: 13.49% ( 278 / 2061 )

Copy link

github-actions bot commented Dec 3, 2024

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 65.43% ( 583 / 891 )
Methods: 59.26% ( 64 / 108 )
Lines: 68.54% ( 464 / 677 )
Branches: 51.89% ( 55 / 106 )

Copy link

github-actions bot commented Dec 3, 2024

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 83.73% ( 1292 / 1543 )
Methods: 81.65% ( 129 / 158 )
Lines: 85.21% ( 1095 / 1285 )
Branches: 68% ( 68 / 100 )

Copy link

github-actions bot commented Dec 3, 2024

E2E SIMS API Coverage Report

Totals Coverage
Statements: 67.17% ( 5844 / 8700 )
Methods: 64.86% ( 720 / 1110 )
Lines: 71.14% ( 4592 / 6455 )
Branches: 46.87% ( 532 / 1135 )

Copy link
Collaborator

@sh16011993 sh16011993 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 @lewischen-aot 👍

@lewischen-aot lewischen-aot added this pull request to the merge queue Dec 3, 2024
Merged via the queue into main with commit 9284050 Dec 3, 2024
21 checks passed
@lewischen-aot lewischen-aot deleted the feature/#3453-coe-ineligible-assessments-part1 branch December 4, 2024 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Camunda Workers DB DB migration involved Institution Institution Features SIMS-Api SIMS-Api
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants