Eligible completions that have no ledger row and are not already in the study registry through the pull path. Exactly the rows the materialiser creates a registration for, and so exactly the rows it may be accused of having missed. fully_eligible is not applied here: a completion still waiting on a prerequisite gets its row and waits in pending.
CREATE VIEW credit_registration_registrable_completions AS (
SELECT course_module_completion_id,
user_id,
course_id,
course_module_id,
completion_date,
created_at,
fully_eligible
FROM credit_registration_eligible_completions e
WHERE ((NOT (EXISTS ( SELECT 1
FROM credit_registrations cr
WHERE ((cr.course_module_completion_id = e.course_module_completion_id) AND (cr.deleted_at IS NULL))))) AND (NOT (EXISTS ( SELECT 1
FROM course_module_completion_registered_to_study_registries r
WHERE ((r.course_module_completion_id = e.course_module_completion_id) AND (r.deleted_at IS NULL))))))
)| Name | Type | Default | Nullable | Children | Parents | Comment |
|---|---|---|---|---|---|---|
| completion_date | timestamp with time zone | true | ||||
| course_id | uuid | true | ||||
| course_module_completion_id | uuid | true | ||||
| course_module_id | uuid | true | ||||
| created_at | timestamp with time zone | true | ||||
| fully_eligible | boolean | true | ||||
| user_id | uuid | true |
| Name | Columns | Comment | Type |
|---|---|---|---|
| public.credit_registration_eligible_completions | 7 | Completions the push path is responsible for: live, passed, ECTS-eligible, on a live module opted in to credit registration. Membership is the hard half of the predicate, which nothing recovers from by waiting; fully_eligible is the soft half, which a prerequisite completed or a suspected-cheating review dismissed can turn true later. Deliberately silent about whether a completion is paused or already has a ledger row: pausing freezes rows where they stand rather than making them ineligible, and having a row is credit_registration_registrable_completions. | VIEW |
| 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_completion_registered_to_study_registries | 10 | Completed course module completion registrations to study registries. | BASE TABLE |
Generated by tbls