Skip to main content

Module verified_student_numbers

Module verified_student_numbers 

Source

Structs§

AdminPageRow đź”’
A row with the page’s total attached, so a page and its count can only come from one query.
AdminVerifiedStudentNumber
One link as an admin support view shows it, with the account it belongs to.
NewVerifiedStudentNumber
VerifiedStudentNumber

Enums§

StudentNumberVerificationMethod
How a student number was proven to belong to an account.

Functions§

count_by_method_since
Live links per method, both all-time and since a cutoff, in one pass over the table, so an admin-established one is never hidden inside a total.
count_unlinked_enrolled_students_for_course
Enrolled students of the course who hold no live student number link, and so cannot have credits registered for them until they link one.
dismiss_auto_link_notice
Puts away the “we linked this for you” notice for one account’s live link. Idempotent; a link the account does not own is left alone, so the caller’s ownership check is the only one needed.
get_admin_page
Live links only, newest first: a retired link is not a number we hold. Returns the page together with how many rows match the filters in total, from one query via COUNT(*) OVER().
get_by_id
get_by_sisu_person_id
The live link for one Sisu person. Unique alongside the student number, so a programme change that issues a new number still collides here.
get_by_sisu_person_ids
The person id rather than the number, because the number changes when a student moves between programmes while the person id does not.
get_by_student_number
get_by_student_numbers
get_by_user_id
The account’s live link, if it has one. At most one exists by partial unique index.
get_by_user_ids
get_latest_including_deleted_by_user_id
The account’s most recent link, retired ones included: a retired link is the only record an unlinked account has of the Sisu person its linking mail was addressed to.
get_latest_including_deleted_by_user_ids
Batched form of get_latest_including_deleted_by_user_id, one row per account.
insert
replace_verified_student_number
Retires current_link_id (the account’s link the caller already resolved, if any), inserts new in its place, clears the mailed links to new’s number that are no longer owed, and audits the change on the account’s live registrations.
soft_delete
Unlinks by soft-delete; relinking inserts a new row, keeping the old number for audit.