Completions the push path is responsible for: live, passed, ECTS-eligible, on a live unit with a course code (and, for a module, credit_registration_route platform), and on the pipeline. For a course module completion that is the push-path mark set at creation; the pull path excludes exactly the rows carrying it. 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 s.course_module_completion_id,
s.user_id,
s.course_id,
s.course_module_id,
s.completion_date,
s.created_at,
s.fully_eligible,
s.subject_id,
s.kind,
s.credit_unit_id,
s.external_completion_id,
s.external_credit_target_id
FROM (credit_registration_subjects s
LEFT JOIN course_modules cm ON ((cm.id = s.course_module_id)))
WHERE (s.is_on_pipeline AND (NOT s.is_withdrawn) AND (s.passed IS TRUE) AND s.eligible_for_ects AND (TRIM(BOTH FROM s.uh_course_code) <> ''::text) AND (cm.deleted_at IS NULL) AND ((cm.credit_registration_route = 'platform'::course_module_credit_registration_route) IS NOT FALSE))
)| 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 | ||||
| credit_unit_id | uuid | true | ||||
| external_completion_id | uuid | true | ||||
| external_credit_target_id | uuid | true | ||||
| fully_eligible | boolean | true | False while the completion still waits on a prerequisite module or on a suspected-cheating review. | |||
| kind | text | true | ||||
| subject_id | uuid | true | ||||
| user_id | uuid | true |
| Name | Columns | Comment | Type |
|---|---|---|---|
| public.credit_registration_subjects | 27 | Every completion a ledger row can register, course module completions and mooc.fi completions alike, with the facts of the completion and of the unit (module or target) it registers for. Ledger rows join it on subject_id. | VIEW |
| public.course_modules | 18 | A module is a collection of chapters which can be used to categorise the chapters of a course. | BASE TABLE |
| s.uh_course_code | 0 |
Generated by tbls