Skip to main content

Module exercises

Module exercises 

Source

Functions§

enforce_deadline 🔒
Returns an error if the chapter’s or exercise’s deadline has passed.
grade_submission 🔒
Grades one slide submission and trims the result down to what the submitter may see. Runs inside process_submission’s transaction.
lock_and_verify_named_uploads 🔒
Re-checks the named uploads under the reaper’s row lock, inside the transaction that records the submission and before anything is written to it.
named_upload_ids 🔒
Collects every uploaded file id named across all of a submission’s file-typed answers.
out_of_tries_error 🔒
The rejection both try-limit checks report, kept in one place because the message reaches the student verbatim.
process_submission
Records and grades one slide submission, having established that its answers may claim the uploads they name.
resolve_course_or_exam_id_and_verify_that_user_can_submit 🔒
The gate a submit runs: everything resolve_course_or_exam_id_for_submitting rejects, plus the per-slide try limit.
resolve_course_or_exam_id_for_submitting 🔒
Resolves the course instance or exam a submission would be recorded against, and rejects a submission the user may not make at all: not enrolled on the course, or past the exam’s window.
try_limit 🔒
The per-slide try limit, or None when the exercise does not limit tries.
verify_any_slide_has_tries_left 🔒
Rejects a user who has used up the try limit on every slide of the exercise. A slide nobody has submitted to has all its tries left.
verify_named_uploads 🔒
Rejects a file-typed answer naming uploads this user did not make for this exercise, naming none at all, or naming the same upload as another task submission in the same slide submission. Also rejects a JSON answer that names files, before anything is written.
verify_user_can_answer_exercise
The same gate as verify_user_can_answer_exercise_slide for a caller that has only an exercise id, such as the native client’s upload route.
verify_user_can_answer_exercise_slide
Rejects an attempt to answer an exercise that a submit would reject anyway: a passed deadline, no enrolment on the course, a closed exam, or no tries left on the slide.