pub async fn link_numbers_reported_by_study_registry(
conn: &mut PgConnection,
user_ids: &[Uuid],
) -> ModelResult<u64>Expand description
Links each of user_ids to the student number a registrar last reported for them, as a
StudentNumberVerificationMethod::StudyRegistry link, and records a conflict wherever a live
link still stands in the way. A link someone made by hand (the student or an admin) always wins,
but another account’s study-registry link on the reported number moves to the account reported
most recently, unless the holder’s own report of it is newer: a student with two accounts gets
the number on the later one. A retired link does
not block: the registrar’s report is authoritative, so a number the student or an admin unlinked,
or one resolve-person-ids dropped over a conflict, is linked again. Returns how many links were
made.