Skip to main content

Module course_modules

Module course_modules 

Source

Structs§

AutomaticCompletionRequirements
CourseAuditingModuleUpdate
CourseModule
Like CourseModulesSchema, but the automatic-completion columns are collapsed into completion_policy.
CourseModuleCreditRegistrationConfig
Per-module credit-registration configuration: the module’s own fields merged with its course_module_suotar_configurations row. Every field of that row is optional here because a module with no configuration row is a valid, unconfigured module.
CourseModulesSchema 🔒
The subset of course_modules columns CourseModule is built from; the credit-registration ones are read through CourseModuleCreditRegistrationConfig, hence no SELECT * here.
ModifiedModule
ModuleSizeCounts
How many chapters and exercises a course module contains. Used for deciding whether the module is small enough to be exempt from the minimum cheater threshold.
ModuleUpdates
NewCourseModule
NewModule

Enums§

CompletionPolicy

Functions§

credit_registration_configs 🔒
Shared by the two getters below, so the join lives in one place.
delete 🔒
Deletes the module without recording history. Errors with InvalidRequest if chapters still belong to it.
ensure_belong_to_course 🔒
Errors with InvalidRequest unless every module and chapter id is a live row of course_id.
get_all_modules
get_all_uh_course_codes
get_by_course_id
get_by_course_id_as_map
Gets course modules for the given course as a map, indexed by the id field.
get_by_course_id_only_with_open_chapters
get_by_course_ids
Batched get_by_course_id: modules for many courses in one query, to group in memory instead of one query per course.
get_by_exercise_id
Gets course module where the given exercise belongs to. This will result in an error in the case of an exam exercise.
get_by_id
get_by_ids
get_chapter_and_exercise_counts
get_course_module_id_by_chapter
get_credit_registration_config
get_credit_registration_configs_by_course_id
Every module of one course with its Suotar configuration, configured or not.
get_default_by_course_id
get_ids_by_course_slug_or_uh_course_code
Gets all course modules with a matching uh_course_code or course slug.
insert
normalize_uh_course_code
Stores a blank course code as None and a real one trimmed, so every reader can test for presence.
registers_credits
Whether a module’s completions are registered at all: it needs a course code and completions_can_be_registered_to_sisu on. Mirrors the SQL side’s TRIM(cm.uh_course_code) <> '' AND cm.completions_can_be_registered_to_sisu predicates.
rename
update_auditing_fields
Sets the UH course codes, ECTS credits and registration link overrides of the course’s modules as the course auditing view edits them, leaving their other fields alone. Modules of other courses are ignored. Returns the ids of the updated modules.
update_automatic_completion_status
update_certification_enabled
Turns certificate generation on or off and records the result in the module’s history.
update_modules
Applies the module editor’s changes to course_id in one transaction, through upsert_from_snapshot, and records the modules and chapters it changed in their history.
update_uh_course_code
upsert_from_snapshot
Writes every field of the snapshot to the module, creating it with the snapshot’s id if it does not exist and bringing it back if it is deleted. Does not record history.
validate_completion_registration_link
Errors with InvalidRequest unless link is empty or an absolute https:// URL. Students get the link as an href, so no other scheme may be stored.