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.
CREATE VIEW credit_registration_eligible_completions AS (
SELECT cmc.id AS course_module_completion_id,
cmc.user_id,
cmc.course_id,
cmc.course_module_id,
cmc.completion_date,
cmc.created_at,
(cmc.prerequisite_modules_completed AND (NOT cmc.needs_to_be_reviewed)) AS fully_eligible
FROM (course_module_completions cmc
JOIN course_modules cm ON ((cm.id = cmc.course_module_id)))
WHERE (cm.enable_credit_registration_via_suotar AND (cm.deleted_at IS NULL) AND (cmc.deleted_at IS NULL) AND cmc.passed AND cmc.eligible_for_ects)
)| 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 | False while the completion still waits on a prerequisite module or on a suspected-cheating review. | |||
| user_id | uuid | true |
| Name | Columns | Comment | Type |
|---|---|---|---|
| public.course_module_completions | 17 | Internal student completions for course modules. | BASE TABLE |
| public.course_modules | 18 | A module is a collection of chapters which can be used to categorise the chapters of a course. | BASE TABLE |
Generated by tbls