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-2254 Late Notification Warning #2884

Merged
merged 8 commits into from
Dec 19, 2024
Merged

PIMS-2254 Late Notification Warning #2884

merged 8 commits into from
Dec 19, 2024

Conversation

dbarkowsky
Copy link
Collaborator

@dbarkowsky dbarkowsky commented Dec 18, 2024

🎯 Summary

PIMS-2254

Changes

  • Re-introduced node-cron package to run this job on a schedule. We had previously removed it when we moved away from Keycloak-roles.
  • Created function to check for late emails, update their status, and send a warning email if there are still Pending notifications
  • Fixed a bug with the fuzzy search that only occurs when you have no parcels/buildings to search from (probably only a developer issue)
  • Standardized the sending email for system messages to PIMS System <[email protected]> between the error report and notification warning emails.

Testing

Make sure your .env file has these set:

CHES_EMAIL_ENABLED=true
CHES_OVERRIDE_TO="yourEmailHere;"
  • Set some existing notifications that were sent from the dev CHES server with past dates to Pending. For example:
UPDATE notification_queue set status = 1 where id in(4, 5, 9);
  • To trigger this function, change the cron schedule in the server.ts file to * * * * * . This should make it fire every minute.
  • The altered notifications should be updated back to their correct status.

To see a copy of the email, set some existing notifications to Pending like noted above, but comment out lines 43-47 of failedEmailCheck.ts. This will keep those notifications as Pending, so the email will be triggered.

🔰 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.

Copy link
Collaborator

@Sharala-Perumal Sharala-Perumal left a comment

Choose a reason for hiding this comment

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

The new function does check for the past pending notifications, sends them to queue and update the status for completion. Tested to receive email notification on projects with pending statuses past their send date.
This ticket can be merged to main when the promise call in Failedemailcheck to log error messages is altered.

@dbarkowsky
Copy link
Collaborator Author

Update call has been edited so that any failed updates will not interfere with others.
They will still log errors from the CHES service and from this function.

@dbarkowsky dbarkowsky merged commit 81868f1 into main Dec 19, 2024
8 checks passed
@dbarkowsky dbarkowsky deleted the PIMS-2254 branch December 19, 2024 22:51
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.

2 participants