diff --git a/services/headless-lms/models/src/library/progressing.rs b/services/headless-lms/models/src/library/progressing.rs index b940c79ee80..30c0d3a4e22 100644 --- a/services/headless-lms/models/src/library/progressing.rs +++ b/services/headless-lms/models/src/library/progressing.rs @@ -566,6 +566,16 @@ pub async fn add_manual_completions( }, ) .await?; + + if completion.grade.is_some() + && (completion.grade > Some(5) || completion.grade < Some(0)) + { + return Err(ModelError::new( + ModelErrorType::PreconditionFailed, + "Invalid grade".to_string(), + None, + )); + } course_module_completions::insert( &mut tx, PKeyPolicy::Generate,