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

#3054 - Email notification for blocked disbursement to ministry only once #4245

Merged
merged 6 commits into from
Jan 15, 2025

Conversation

andrewsignori-aot
Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot commented Jan 15, 2025

  • Created a base class for e-Cert notifications (ECertNotification) and segregated the logic to generate blocked notifications into MinistryBlockedDisbursementNotification and StudentBlockedDisbursementNotification.
  • Existing logic was moved into the new files.
    • Code for the method shouldCreateNotification for the Students was moved and no changes were done for this PR, unless critical no comments will be addressed.
  • ECertNotification can be used for any other e-Cert notification as required, not only blocked disbursement.

Please note that the student data required to generate the notification is now retrieved twice in the event that the disbursement is blocked and the Ministry should be notified for the first time. The benefit of having the separation between the logic for the different notifications seems greater than an occasional extra query to the student's table. Please note that the query was simplified from what it used to be.

Please also note that the below technical AC was not executed. The queries have different approaches, sometimes checking the existence, sometimes requiring a count, and sometimes requiring a count and a date last sent. I did not see a benefit for this PR. Please share an opinion/suggestion if needed.

Create a generic method to check, if the email notifications are already sent to a particular template and metadata( disbursementId).

Copy link

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 65.59% ( 589 / 898 )
Methods: 59.63% ( 65 / 109 )
Lines: 68.72% ( 468 / 681 )
Branches: 51.85% ( 56 / 108 )

Copy link

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 22.52% ( 3864 / 17157 )
Methods: 10.33% ( 224 / 2169 )
Lines: 25.93% ( 3336 / 12864 )
Branches: 14.31% ( 304 / 2124 )

Copy link

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 86.14% ( 1249 / 1450 )
Methods: 82.42% ( 136 / 165 )
Lines: 88.51% ( 1032 / 1166 )
Branches: 68.07% ( 81 / 119 )

Copy link

E2E SIMS API Coverage Report

Totals Coverage
Statements: 67.77% ( 5994 / 8844 )
Methods: 65.57% ( 739 / 1127 )
Lines: 71.63% ( 4696 / 6556 )
Branches: 48.15% ( 559 / 1161 )

@andrewsignori-aot andrewsignori-aot marked this pull request as ready for review January 15, 2025 17:23
Comment on lines +28 to +32
const notifications = [
this.ministryBlockedDisbursementNotification,
this.studentBlockedDisbursementNotification,
].map((notification) =>
notification.notify(eCertDisbursement, entityManager, log),
Copy link
Collaborator

@lewischen-aot lewischen-aot Jan 15, 2025

Choose a reason for hiding this comment

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

❤️ What a great way to segregate different notification services.

Copy link
Collaborator

@lewischen-aot lewischen-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👍Great way to segregate different notification services ❤️

* Provides a basic structure for creating and
* sending notifications related to e-Cert disbursements.
*/
export abstract class ECertNotification {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great job! I love the way how the way how the e-cert based notifications are handled here with extensibility to add more notifications.

* Provides a basic structure for creating and
* sending notifications related to e-Cert disbursements.
*/
export abstract class ECertNotification {
Copy link
Collaborator

Choose a reason for hiding this comment

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

One minor comment to mention. As this is a base class to create notifications, the student data is a core common part that can be built from a base class method. And that base class method can be called inside createNotification()

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 idea was that each notification could evolve differently and the data required for each should be handled in the inherited class. For instance, a notification for the Ministry could potentially contain further information about the blocked disbursement or something else. Assuming all notifications will have the student data as a core would not be accurate IMO.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Excluding ministry emails for institutions, other ministry notifications have student first and last name as common. But not a blocker considering the present.

@dheepak-aot
Copy link
Collaborator

Amazing work @andrewsignori-aot. Just one comment.

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.

Great Job! Looks good👍

@andrewsignori-aot andrewsignori-aot deleted the feature/#3054-email-notification-disbursement branch January 17, 2025 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants