Skip to main content

Module chapters

Module chapters 

Source

Structs§

Chapter
ChapterAvailability
ChapterExerciseDeadlineOverrideSummary
ChapterInfo
ChapterLockPreview
ChapterPagesWithExercises
ChapterUpdate
ChapterWithStatus
CourseUserInfo
DatabaseChapter
NewChapter
UnreturnedExercise
UserChapterProgress
UserCourseInstanceChapterProgress

Enums§

ChapterStatus

Functions§

chapter_image_path_is_referenced
Whether a live chapter still uses this image path.
course_instance_chapters
delete_chapter
Deletes the chapter with its pages and exercises, and records the deletions in the history of the chapter and its pages.
exercise_deadline_overrides_by_chapter_for_course
fetch_chapter_availability
fetch_course_users
fetch_user_chapter_progress
Per-user chapter progress for a course. When user_ids is Some, only those users are included; when None, every user with progress in the course is returned.
first_chapters_to_unlock
The chapters a student starts chapter locking with: the base module’s chapters up to and including the first one with exercises. Errors with NotFound if the course has no base module.
front_page_path
The path of the front page of the chapter with the number.
get_by_ids
The chapters with the ids that aren’t deleted, in no particular order.
get_chapter
get_chapter_by_page_id
get_chapter_info_by_page_metadata
get_chapter_lock_preview
get_course_chapters
get_course_id
get_course_ids
The course of each of the chapters, by chapter id; deleted chapters included.
get_for_module
get_previous_chapters_in_module
get_user_course_instance_chapter_progress
insert
is_open
Checks the opens_at field for the chapter and compares it to the current time. If null, the chapter is always open.
is_open_at
Whether a chapter that opens at opens_at is open at time; one with no opening time always is.
move_chapter_exercises_to_manual_review
page_path
The path of a page of the chapter with the number: the front_page_path for an empty segment, <front page path>/<segment> otherwise.
page_path_segment
The segment page_path would build url_path from for the chapter with the number; None when the path is not under that chapter’s front page path.
save_edit 🔒
Writes the change edit makes to the chapter’s snapshot and records the result in its history.
set_front_page
set_module
set_opens_at
unlock_next_chapters_for_user
Unlocks the next chapter(s) for a user after they complete a chapter. If the completed chapter is the last in a base module (order_number == 0), unlocks the first chapter of all additional modules (order_number != 0). Otherwise, unlocks the next chapter in the same module. Note: If a module has no chapters with exercises, all chapters in that module will be unlocked. This is intentional to allow progression through content-only chapters.
update_chapter
Saves the chapter’s editable fields and records the result in its history. A missing course_module_id keeps the chapter’s module.
update_chapter_image_path
Sets the chapter’s image and records the result in its history.
upsert_from_snapshot
Writes every field of the snapshot to the chapter, creating it with the snapshot’s id if it does not exist and bringing it back if it is deleted. Does not touch the chapter’s pages.