Completions the push path is responsible for: live, passed, ECTS-eligible, on a live module with a course code and completions_can_be_registered_to_sisu on, and marked for the push path when they were created. The pull path excludes exactly the rows carrying the mark. 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 (cmc.register_credits_via_suotar AND (cm.deleted_at IS NULL) AND (TRIM(BOTH FROM cm.uh_course_code) <> ''::text) AND cm.completions_can_be_registered_to_sisu 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 | 18 | Internal student completions for course modules. | BASE TABLE |
| public.course_modules | 17 | A module is a collection of chapters which can be used to categorise the chapters of a course. | BASE TABLE |
| cm.uh_course_code | 0 |
Generated by tbls