Skip to main content

Module student_notifications

Module student_notifications 

Source
Expand description

The two terminal-state mails a student may get about a credit registration.

There are exactly two, and each is sent at most once per ledger row. Idempotency lives in the credit_registrations.{action_needed,registered}_email_delivery_id columns rather than in the phase, so a re-tick, a restart or a row re-entering the state cannot mail twice. A grade-improvement attempt is a new row and does get its own mail.

Structs§

RegistrationNotificationEmail
One queued student mail and what we can honestly say about it.
StudentNotificationToQueue
One row owed a mail, with everything the message renders. open_university_product_id is the module’s configured product, from which the action-needed mail’s enrolment link is built.

Enums§

CreditRegistrationNotificationKind
Which of the two student mails a row is owed, or already holds.

Constants§

STUDENT_NOTIFICATION_LIMIT
How many mails one iteration queues.

Functions§

claim_unnotified
Claims the rows owed a mail, locking them until the caller’s transaction ends, so callers must pass a transaction. Never claims cancelled, blocked or any failure state: those get nothing.
get_for_registrations
The mails queued for these rows, for the student, teacher and admin views that report on them. A row with neither mail queued yet contributes nothing.
set_email_delivery_id
Records which delivery carries the mail, which is also what takes the row out of the queue.