Skip to main content

verify_user_can_answer_exercise_slide

Function verify_user_can_answer_exercise_slide 

Source
pub async fn verify_user_can_answer_exercise_slide(
    conn: &mut PgConnection,
    user_id: Uuid,
    exercise: &Exercise,
    slide_id: Uuid,
) -> Result<(), ControllerError>
Expand description

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.

Meant for work a student does before submitting, such as uploading an answer’s files: those objects occupy the store for days, so they must not be accepted from someone who could never submit them. Submitting re-runs these checks, so this is a gate, not a guarantee.