Skip to main content

Module pages

Module pages 

Source

Structsยง

CmsPageExercise
CmsPageExerciseSlide
CmsPageExerciseTask
CmsPageSave
A CMS page save. It is refused as stale when expected_updated_at is set and the page has changed since that version; leave it unset to overwrite.
CmsPageUpdate
ContentManagementPage
CourseMaterialPageContentFilterCache ๐Ÿ”’
CoursePageWithUserData
DerivedSpec ๐Ÿ”’
A derived spec, with the stored files the exercise service declared it references.
DerivedSpecResponse ๐Ÿ”’
The body a service that declares its spec files returns from the public-spec and model-solution endpoints, in place of the bare spec.
ExerciseTaskIdAndSpec ๐Ÿ”’
ExerciseWithExerciseTasks
HistoryRestoreData
IsChapterFrontPage
NewCoursePage
NewPage
Represents the subset of page fields that are required to create a new page.
NormalizedCmsExerciseTask
Page
PageAudioFiles
PageBlockReferences
A feedback or edit proposal on a page and the blocks of the page it is about, in the order the record lists them.
PageChapterAndCourseInformation
PageChatbotContext
The fields the chatbot needs to describe a page: enough to build the page-context message, none of the Gutenberg content JSONB.
PageDetailsUpdate
Represents the subset of page fields that can be updated from the main frontend dialog โ€œEdit page detailsโ€.
PageExercises
A pageโ€™s exercises with their slides, tasks and custom peer-review settings, as the CMS edits them.
PageIdAndUrlPath
PageInfo
PageInfoSpecial
PageMetadata
PageNavigationInformation
PageRoutingData
PageRow
Fields of a page row that exist before its content is written.
PageSearchResult
PageUpdateArgs
PageWithExercises
RawPageSearchResult ๐Ÿ”’
SearchContentHeadlineRow ๐Ÿ”’
SearchRequest

Enumsยง

ExistingTasks
Where a saved task already existing means that saving it adds nothing.
LockChapterContentState
PageSearchQueryType ๐Ÿ”’
PageVisibility

Constantsยง

URL_PATH_ENCODE_SET ๐Ÿ”’

Functionsยง

add_course_url_prefix_to_search_results ๐Ÿ”’
build_public_search_content_headlines ๐Ÿ”’
clean_url_path_segment ๐Ÿ”’
Cleans a single path segment (no /): whitespace runs become a single -, unsafe ASCII is dropped, runs of - collapse to one, and leading/trailing - are trimmed.
collect_searchable_text_from_content_value ๐Ÿ”’
create_for_course_id
decode_percent_runs ๐Ÿ”’
Decode each maximal run of %XX escapes as one UTF-8 unit, dropping a run that isnโ€™t valid UTF-8 (rather than emitting U+FFFD). Non-escape characters pass through. Mirrors the migrationโ€™s safe_percent_decode, so storage and lookup agree on inputs like /%FF.
delete_page_and_exercises
exercises_of_pages
The exercises of each page, by page id. Pages without exercises are left out.
exists
Whether the page exists and is not deleted.
extract_searchable_text_from_content_value ๐Ÿ”’
fetch_derived_spec ๐Ÿ”’
filter_course_material_page
filter_course_material_page_with_cache ๐Ÿ”’
filter_course_material_pages
filter_course_material_pages_with_exercises
find_page_by_requested_path ๐Ÿ”’
Looks up a non-deleted page in course_id whose stored url_path matches url_path in either the decoded-canonical or the legacy fully-encoded form (see url_path_lookup_candidates). Shared by the page lookup and its tests so both exercise the same candidate-matching logic.
fork_peer_or_self_review_config
Re-keys a custom peer-review config and its questions onto new_exercise_id with config and question ids from new_id, producing an independent copy for a duplicated exercise so it does not collapse onto the original exerciseโ€™s config (#148). All questions must belong to config.
get_all_by_course_id_and_visibility
Gets all pages that belong to the given course that match the visibility filter.
get_by_exam_id
Gets the page that belongs to the given exam. For exams, the page visibility is ignored.
get_by_ids_and_visibility
get_by_ids_deleted_and_visibility
get_chapter_front_page_by_page_id
get_chapter_page_paths
Like get_chapter_pages, projected down to id and url_path for callers that only rewrite paths and would otherwise pull every pageโ€™s content JSONB for nothing.
get_chapter_pages
get_chapters_pages_with_exercises
get_chapters_visible_pages_exclude_main_frontpage
get_course_and_exam_id
get_course_page_with_user_data_from_selected_page
get_course_pages_by_chapter_id_and_visibility
Gets all pages that belong to the given chapter that match the visibility filter.
get_course_top_level_pages_by_course_id_and_visibility
Gets all pages that belong to the given course but not in any chapter.
get_current_page_metadata ๐Ÿ”’
get_front_page_by_chapter_id
get_global_admin_only_exercise_service_names_added_by_tasks
Names of the exercise services that only global admins can add which saving exercise_tasks would add: a task counts as added unless it is the first submitted task with its id and a task with that id and type already exists where existing says.
get_lock_chapter_content_state_for_page ๐Ÿ”’
get_next_order_number_for_courses_top_level_pages ๐Ÿ”’
get_next_page
get_next_page_by_chapter_number ๐Ÿ”’
get_next_page_by_order_number ๐Ÿ”’
get_next_page_order_number_in_chapter ๐Ÿ”’
get_organization_id
get_page
get_page_by_course_id_and_language_group
get_page_by_stored_path ๐Ÿ”’
get_page_chapter_and_course_information
get_page_chatbot_context
Like get_page, but projects only the columns the chatbot needs and folds in the chapter name, so the caller does not also have to fetch the whole page (including content) or the chapter.
get_page_info
get_page_info_special_for_course
get_page_navigation_data
get_page_search_results ๐Ÿ”’
get_page_search_results_for_phrase
Returns search results for a phrase i.e. looks for matches where the words come up right after each other
get_page_search_results_for_words
Returns search results for the given words. The words can appear in the source document in any order.
get_page_with_exercises
get_page_with_user_data_by_path
get_pages_by_course_id
get_previous_page
get_previous_page_by_chapter_number ๐Ÿ”’
get_previous_page_by_order_number ๐Ÿ”’
get_titles_by_ids
Titles for a set of pages, for annotating rows that only carry a page id.
insert_course_page
insert_exam_page
insert_new_content_page
insert_or_undelete_course_page_row ๐Ÿ”’
Creates the snapshotโ€™s page empty under its id, or brings back the deleted page with that id, so that update_page can write its content and exercises next. Writes no page history: the content save that follows does. Errors with PreconditionFailed if the page belongs to another course.
insert_page
insert_page_row
Inserts a page with the given content, a course page in a new page language group of its course. Writes no page history.
is_chapter_front_page
Whether the page is its chapterโ€™s front page; false for a page outside chapters or one that doesnโ€™t exist.
is_unsafe_ascii ๐Ÿ”’
Whether ch is an ASCII char that URL_PATH_ENCODE_SET would encode. The setโ€™s membership test is crate-private, so probe it via utf8_percent_encode (which encodes an ASCII char iff itโ€™s in the set). ASCII-only: the caller keeps non-ASCII verbatim.
legacy_fully_encoded_url_path ๐Ÿ”’
Legacy lookup candidate: the oldest form, with non-ASCII percent-encoded too. Lets pages stored that way still resolve.
legacy_partially_encoded_url_path ๐Ÿ”’
Legacy lookup candidate: unsafe ASCII percent-encoded, non-ASCII kept decoded โ€” the form used before paths were stored stripped. Lets pages written that way (notably exam pages, which the cleanup migration skips) still resolve.
normalize_url_path_for_storage
Canonical storage/lookup form: decode %xx, then per /-segment turn whitespace into -, strip the unsafe ASCII in URL_PATH_ENCODE_SET, and collapse/trim dashes. Case, non-ASCII and /, -, ., _, ~ are kept. Unsafe chars are removed, not %xx-encoded, so every save funnels through here and paths canโ€™t re-accumulate escapes. Mirrors clean_url_path (page migration) and the frontend cleanUrlPath; keep the three in agreement.
percent_escape_byte_at ๐Ÿ”’
The byte a %XX escape at chars[i] decodes to, or None if there isnโ€™t one there.
rekey_peer_or_self_review_questions ๐Ÿ”’
Gives questions fresh ids pointing at target_config_id when it differs from source_config_id (i.e. they are being cloned onto a different config); otherwise returns them untouched so the upsert reuses the existing rows.
reorder_chapters
Saves new chapter numbers, moving the chaptersโ€™ page paths along with redirects from the old ones, and records the reordered chapters in their history.
reorder_pages
Makes the order numbers and chapter ids to match in the db whatโ€™s in the page objects Assumes that all pages belong to the given course id Also assumes the list of pages includes all nondeleted pages in the course, except chapter front pages, which cannot be moved, otherwise we will end up with random order numbers
restore
Restore page contents and exercises to a previous revision
restore_from_history_for_page_id
sanitized_searchable_text_for_public_page ๐Ÿ”’
set_paths
Moves pages to new paths, normalized as the page save stores them, and redirects each moved course pageโ€™s old path to it. Returns those redirects; pages already at their path, deleted pages and exam pages get none.
try_to_find_redirected_page
try_to_find_redirected_page_by_stored_path ๐Ÿ”’
update_by_id_in_parent_context
With expected_updated_at set, refuses with ModelErrorType::StaleVersion unless the page row still has that updated_at. The check runs under the page row lock.
update_page
update_page_content
Only used when testing.
update_page_details
upsert_exercise_slides ๐Ÿ”’
Remaps ids from updates to exercise slides that may have their ids changed.
upsert_exercise_tasks ๐Ÿ”’
Remaps ids from updates to exercise tasks that may have their ids changed.
upsert_exercises ๐Ÿ”’
Remaps ids from updates to exercises that may have their ids regenerated.
upsert_from_snapshot
Writes every field of the snapshot to the page through the CMS page save, creating the page with the snapshotโ€™s id first when is_create. The save records page history as author. Returns the redirect from the pageโ€™s old path when its path changed.
upsert_peer_or_self_review_configs
upsert_peer_or_self_review_questions
url_path_lookup_candidates ๐Ÿ”’
Stored url_path forms to try for a requested path: the strip-canonical form plus the two legacy encoded forms, deduped (an ASCII-only safe path yields a single candidate).
with_exercises
The fetched page with its exercises, as the CMS edits it.
write_paths ๐Ÿ”’
set_paths with the paths written as given; ids and url_paths are parallel.