Skip to main content

Module suspected_cheaters

Module suspected_cheaters 

Source

Structs§

CourseModuleThresholdInfo
Per-module threshold configuration plus the policy-derived limits the configuration UI needs to render and validate the threshold form. Computed server-side so the exemption rule and the minimum/default values live in one place instead of being duplicated in the frontend.
DeletedSuspectedCheater
SuspectedCheaters
Threshold
ThresholdData

Enums§

SuspectedCheaterStatus
Review state of a suspected cheater.

Constants§

DEFAULT_CHEATER_THRESHOLD_SECONDS
3 hours, in seconds. Default threshold used when a course has no explicit threshold configured but cheater detection is enabled.
MINIMUM_CHEATER_THRESHOLD_SECONDS
Teachers cannot configure a threshold below this (3 hours).
SMALL_MODULE_MAX_CHAPTERS
Modules with at most this many chapters are exempt from the minimum threshold; for them any duration >= 0 is allowed, where 0 turns the duration check off.
SMALL_MODULE_MAX_EXERCISES
Modules with at most this many exercises are exempt from the minimum threshold; for them any duration >= 0 is allowed, where 0 turns the duration check off.

Functions§

confirm_cheater_by_user_id_and_course_id
Confirms that a student cheated and applies the consequence: their completions in the course are failed (passed = false, grade = 0), with the previous values snapshotted so the confirmation can be undone by dismiss_by_user_id_and_course_id. Atomic.
delete_threshold_for_module
dismiss_by_user_id_and_course_id
Dismisses the suspicion against a student (marks it a false alarm), clears the “needs to be reviewed” flag on their completions, and restores any grade that a prior cheating confirmation had failed (a no-op if the student was never confirmed). Atomic.
get_all_suspected_cheaters_in_course
get_by_user_id_and_course_id
get_count_in_course_by_status
Counts the suspected cheaters in a given review state for a course.
get_suspected_cheaters_by_id
get_threshold_info_for_course
Returns the configured threshold (if any) and the policy-derived minimum/default for every non-deleted module in the course. The exemption rule is applied here so the configuration UI does not have to recompute module sizes or duplicate the threshold constants.
get_thresholds_by_id
get_thresholds_by_module_id
insert
insert_thresholds
insert_thresholds_by_module_id
minimum_threshold_seconds
The smallest threshold (in seconds) a teacher may configure for a module of the given size: 0 for small (exempt) modules, otherwise MINIMUM_CHEATER_THRESHOLD_SECONDS.
module_exempt_from_minimum
Whether a module of the given size is exempt from the minimum cheater threshold. Small modules can legitimately be completed fast, so for them any duration >= 0 is allowed (0 disables the duration check). This is the single source of truth for the exemption rule – both the save-time validation and the configuration UI derive their behaviour from it (the latter via get_threshold_info_for_course).
validate_threshold_duration 🔒
Guards the invariant that a stored threshold is never negative. progressing.rs treats a stored value of <= 0 as “duration check disabled”, so a stray negative write would silently turn off cheater detection; rejecting it here protects every writer, not just the HTTP handler.