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

PIMS 1957/1958: Handle agency response change notifications #2610

Merged

Conversation

GrahamS-Quartech
Copy link
Contributor

🎯 Summary

PIMS-1957
PIMS-1958

  • Added a helper function to projectServices which will compare old agency response to new responses and check for differences.
  • Added a helper function to utils to get the number of days elapsed between two UTC dates.
  • Adds a new function, generateProjectWatchNotifications, which mirrors the functionality of a similarly named function in the old backend. This function will cancel notifications if an agency response was moved to a non-subscribe status, or queue new notifications if an agency was newly added to subscribe.
  • Modified the handleProjectNotifications function to trigger both generateProjectNotifications and generateProjectWatchNotifications.

🔰 Checklist

  • I have read and agree with the following checklist and am following the guidelines in our Code of Conduct document.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation where required.
  • I have tested my changes to the best of my ability.
  • My changes generate no new warnings.

…ations for agencies that have newly been added as subscribed to the project
…esponses. Fixed some issues with determening whether an existing notification was queued that was preventing new notifications from being queued.
Copy link

github-actions bot commented Aug 7, 2024

🚀 Deployment Information

The Express API Image has been built with the tag: 2610. Please make sure to utilize this specific tag when promoting these changes to the TEST and PROD environments during the API deployment. For more updates please monitor Image Tags Page on Wiki.

Copy link

codeclimate bot commented Aug 7, 2024

Code Climate has analyzed commit 21b9cf9 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

The test coverage on the diff in this pull request is 87.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 93.8%.

View more on Code Climate.

@LawrenceLau2020
Copy link
Collaborator

Testing the "unsubscribe" options seems to work fine, after choosing an agency that had already had pending notifications, I added this agency and after clicking confirm I needed to refresh the page in order to see the updated table with the 3 cancelled notifications. Perhaps we can refresh the notifications table after the "confirm"?

When testing the "subscribe" option, I was expecting to receive an email as well as seeing the notifications table get updated with the new agency interest, but didn't get an email so maybe this isn't being triggered after clicking "confirm"?

image

…rent send date. Modified the logic in generateWatchNotifications to use the most recent project update date to determine the send date
…layed watch notifications. Also added some comments.
@LawrenceLau2020
Copy link
Collaborator

Re-tested the agency interest by adding an interest for Emily Carr University, and there were 3 new pending notifications in the table after confirming. Then changed the interest to "Watch" which cancels the notification, and then changing the interest back to "Subscribe" will create 3 new "pending" notifications for this agency as well.

The notifications table is refreshing nicely as well, so I'm going to approve this ticket.

image

… of github.com:bcgov/PIMS into PIMS-1957/1958-HandleAgencyResponseChangeNotifications
Copy link
Collaborator

@dbarkowsky dbarkowsky left a comment

Choose a reason for hiding this comment

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

Last changes made the emails scheduled to send at correct times!

@GrahamS-Quartech GrahamS-Quartech merged commit 7533f3f into main Aug 8, 2024
13 checks passed
@GrahamS-Quartech GrahamS-Quartech deleted the PIMS-1957/1958-HandleAgencyResponseChangeNotifications branch August 8, 2024 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants