Index

public.credit_registration_preconditions

Description

The things one ledger row waits on, as they stand right now. The ledger records only that a row is pending, so this is where every surface that names the blocker, and the precondition recompute that acts on it, read the same answer.

Table Definition
CREATE VIEW credit_registration_preconditions AS (
 SELECT cr.id AS credit_registration_id,
    (cmc.deleted_at IS NOT NULL) AS completion_deleted,
    ((cmc.deleted_at IS NULL) AND cmc.passed AND cmc.eligible_for_ects AND cmc.prerequisite_modules_completed AND (NOT cmc.needs_to_be_reviewed)) AS completion_eligible,
    (vsn.id IS NOT NULL) AS has_verified_student_number,
    ((cr.student_number IS NOT NULL) AND (((vsn.student_number)::text IS DISTINCT FROM (cr.student_number)::text) OR ((vsn.sisu_person_id)::text IS DISTINCT FROM (cr.sisu_person_id)::text))) AS frozen_identity_stale
   FROM ((credit_registrations cr
     JOIN course_module_completions cmc ON ((cmc.id = cr.course_module_completion_id)))
     LEFT JOIN verified_student_numbers vsn ON (((vsn.user_id = cr.user_id) AND (vsn.deleted_at IS NULL))))
)

Columns

Name Type Default Nullable Children Parents Comment
completion_deleted boolean true
completion_eligible boolean true
credit_registration_id uuid true
frozen_identity_stale boolean true The account has relinked to a different verified student number since this row froze its payload for import. A relink soft-deletes and re-inserts in one transaction, so has_verified_student_number stays true throughout and catches none of it.
has_verified_student_number boolean true

Referenced Tables

Name Columns Comment Type
cr.student_number 0
cr.sisu_person_id 0
public.credit_registrations 46 The credit registration ledger: one row per attempt at registering one course module completion into the study registry via Suotar. Every state write goes through credit_registrations::transition, which stamps state_entered_at and appends an event row in the same transaction; nothing else may update state. BASE TABLE
public.course_module_completions 17 Internal student completions for course modules. BASE TABLE
public.verified_student_numbers 18 Student numbers proven to belong to a courses.mooc.fi account. Global per account: one live row per user, one per student number and one per Sisu person id. Relinking soft-deletes the old row and inserts a new one; student_number is never updated in place because the old value is audit-relevant. BASE TABLE

Relations

er

Generated by tbls