Embeddings of course name, description, audience and prerequisite texts, made before a save’s
transaction so that the save doesn’t wait for the embedding API while holding row locks. Texts
it lacks, such as ones changed in between, are embedded during the save.
The AI policy a teacher has selected for a course. Drives which variant of the student-facing
AI usage notice is shown; NotSet (the default) keeps the generic default message.
Lets the rest of the transaction swap chapter numbers, module and page order numbers, page
paths and citation keys, and point a chapter at a front page it writes later; these
constraints are checked at commit.
The courses the user holds a role in, directly or through the course’s organization, by name.
Which of them the user may edit is for headless_lms_authorization to decide.
Courses the user is enrolled on, through any of their instances, that contain at least one
task of any of the given exercise types; each course once, ordered by name. An empty
exercise_types matches nothing.
Finds courses by slug or (fuzzy) name for the support chatbot’s find_course tool. Exact
slug matches rank first, then substring name matches, then trigram similarity to name.
Enables or disables suspected-cheater detection for a single course. Used by the seed routine to
turn detection off for seeded courses (which are completed in seconds and would otherwise flag
every seeded user); production courses keep the on-by-default value set at creation.
Saves the course’s editable fields and records the result in its history. Errors with
PreconditionFailed if the update changes can_add_chatbot and can_change_chatbot is false.
Saves the auditing view’s changes and records the course settings and modules it changed in
their history. Modules of other courses in the update are ignored.
Saves the course’s prerequisites as listed, deleting the ones left out. Only new and changed
prerequisites get new embeddings, taken from embeddings where it has them.
Writes the course settings of the snapshot without recording history: the course row in one
write, and the audiences that differ from live, the current settings. Embeddings of the
changed name, description and audiences come from embeddings where it has them. Errors with
PreconditionFailed if the snapshot is of another course, or if it changes can_add_chatbot
and can_change_chatbot is false.