Skip to main content

verify_user_can_answer_exercise

Function verify_user_can_answer_exercise 

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

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.

The try limit is per slide, so without a slide id this can only reject a user who has exhausted every slide of the exercise; one who is out of tries on the slide they actually mean to answer still gets through here and is rejected on submit. Everything else – deadline, enrolment, exam window – is checked in full.