Index

public.external_credit_targets

Description

A mooc.fi course whose credits courses registers into the study registry, standing in for both course_modules and course_module_suotar_configurations for mooc.fi ledger rows. Each tier of a course maps to at most one live target, enforced by the external_credit_targets_tier_overlap trigger, so a completion registers one course code per tier it has had.

Columns

Name Type Default Nullable Children Parents Comment
checked_course_code varchar(255) true The course code course_code_allowed is a verdict on. Once uh_course_code changes, the verdict no longer applies.
config_check_message text true What the last configuration check found, for operators.
config_checked_at timestamp with time zone true When config-validation last asked Suotar about the course code.
consecutive_listing_failures integer 0 false Failed listing attempts since the last success.
course_code_allowed boolean true Suotar’s last verdict on checked_course_code. NULL means never checked, which is not a failed check.
course_code_rejection text true Suotar’s own reason for not accepting checked_course_code, quoted to operators. NULL unless course_code_allowed is false.
created_at timestamp with time zone now() false Timestamp when the record was created.
delegated_at timestamp with time zone false The cutoff: completions dated at or after it are registered by courses, earlier ones by the mooc.fi pull. Must equal credit_registration_delegated_at of the mooc.fi course, and be the same on every live target of that course; a target with ledger rows must not have it changed.
deleted_at timestamp with time zone true Timestamp when the record was deleted. If null, the record is not deleted. Deleting a target withdraws its completions, cancelling their rows not yet submitted.
ects_credits real false Credits registered per completion.
enabled_at timestamp with time zone true When registration through this target was switched on. NULL keeps every phase away from it.
enrolment_link text true Where a student with no usable enrolment is sent to enrol, usually the Open University course page.
grading external_grading false Whether the course is graded pass/fail or numerically, which decides how a completion without a grade reads.
id uuid uuid_generate_v4() false public.credit_registration_account_linking_emails public.credit_registration_enrolment_check_outcomes public.credit_registrations public.external_completions A unique, stable identifier for the record.
language_code varchar(15) false Language of the mails about this target, and the attainment language for a completion that has none.
last_listed_at timestamp with time zone true When such a listing last succeeded.
last_listing_attempted_at timestamp with time zone true When enrolment discovery last tried to list the course code’s enrolments for this target.
last_listing_error credit_registration_error_code true Why the last listing attempt failed, null once one succeeds. What separates a failed listing from an empty course.
moocfi_course_checked_at timestamp with time zone true When mooc.fi last answered about the course, for refreshing moocfi_has_certificate when it gets old.
moocfi_course_id uuid false The mooc.fi course the completions are stored on, which is the handler course when another course hands its completions to it. Never the slug, which can change.
moocfi_course_slug varchar(255) false The mooc.fi course slug, for links back to mooc.fi only.
moocfi_has_certificate boolean true Whether mooc.fi said the course has a certificate the last time courses asked, which decides whether students are offered the certificate instead of credits. NULL until mooc.fi has answered; the offer stands while it is unknown.
name varchar(255) false The mooc.fi course’s name, without a prefix. Queries that list it beside native courses show it as “mooc.fi:” and the name.
pause_reason text true Why the target was paused, as the admin wrote it.
paused_at timestamp with time zone true When an admin paused the target. Pausing freezes its ledger rows where they stand rather than cancelling them.
paused_by_user_id uuid true public.users The admin who paused the target.
tiers int4range true The completion tiers this target registers. NULL for an untiered course, which registers every completion; otherwise a completion whose tier is outside the range is not this target’s.
uh_course_code varchar(255) false The University of Helsinki course code the credits are registered under.
updated_at timestamp with time zone now() false Timestamp when the record was last updated. The field is updated automatically by the set_timestamp trigger.

Constraints

Name Type Definition
external_credit_targets_check_result CHECK CHECK (((config_checked_at IS NOT NULL) OR (course_code_allowed IS NULL)))
external_credit_targets_consecutive_listing_failures_check CHECK CHECK ((consecutive_listing_failures >= 0))
external_credit_targets_consecutive_listing_failures_not_null n NOT NULL consecutive_listing_failures
external_credit_targets_created_at_not_null n NOT NULL created_at
external_credit_targets_delegated_at_not_null n NOT NULL delegated_at
external_credit_targets_ects_credits_check CHECK CHECK ((ects_credits > (0)::double precision))
external_credit_targets_ects_credits_not_null n NOT NULL ects_credits
external_credit_targets_grading_not_null n NOT NULL grading
external_credit_targets_id_not_null n NOT NULL id
external_credit_targets_language_code_check CHECK CHECK (((language_code)::text ~ ‘1{2,3}(-[A-Z][a-z]{3})?(-[A-Z]{2})?$’::text))
external_credit_targets_language_code_not_null n NOT NULL language_code
external_credit_targets_moocfi_course_id_not_null n NOT NULL moocfi_course_id
external_credit_targets_moocfi_course_slug_not_null n NOT NULL moocfi_course_slug
external_credit_targets_name_not_null n NOT NULL name
external_credit_targets_pause_pair CHECK CHECK (((paused_at IS NULL) = (paused_by_user_id IS NULL)))
external_credit_targets_paused_by_user_id_fkey FOREIGN KEY FOREIGN KEY (paused_by_user_id) REFERENCES users(id)
external_credit_targets_pkey PRIMARY KEY PRIMARY KEY (id)
external_credit_targets_tier_overlap TRIGGER CREATE CONSTRAINT TRIGGER external_credit_targets_tier_overlap AFTER INSERT OR UPDATE OF moocfi_course_id, tiers, deleted_at ON public.external_credit_targets NOT DEFERRABLE INITIALLY IMMEDIATE FOR EACH ROW EXECUTE FUNCTION check_external_credit_target_tier_overlap()
external_credit_targets_tiers_check CHECK CHECK ((NOT isempty(tiers)))
external_credit_targets_uh_course_code_check CHECK CHECK ((TRIM(BOTH FROM uh_course_code) <> ’’::text))
external_credit_targets_uh_course_code_not_null n NOT NULL uh_course_code
external_credit_targets_updated_at_not_null n NOT NULL updated_at

Indexes

Name Definition
external_credit_targets_pkey CREATE UNIQUE INDEX external_credit_targets_pkey ON public.external_credit_targets USING btree (id)
uq_external_credit_targets_course_code CREATE UNIQUE INDEX uq_external_credit_targets_course_code ON public.external_credit_targets USING btree (moocfi_course_id, uh_course_code) WHERE (deleted_at IS NULL)

Triggers

Name Definition
external_credit_targets_tier_overlap CREATE CONSTRAINT TRIGGER external_credit_targets_tier_overlap AFTER INSERT OR UPDATE OF moocfi_course_id, tiers, deleted_at ON public.external_credit_targets NOT DEFERRABLE INITIALLY IMMEDIATE FOR EACH ROW EXECUTE FUNCTION check_external_credit_target_tier_overlap()
set_timestamp CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.external_credit_targets FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()

Relations

er

Generated by tbls


  1. a-z↩︎