From 239dc8d38df9fc5b6f4f10555b6cf61a8d7e7aa1 Mon Sep 17 00:00:00 2001 From: Maija Y Date: Wed, 17 Jul 2024 20:45:43 +0300 Subject: [PATCH] Fix to validation --- services/headless-lms/models/src/library/progressing.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/headless-lms/models/src/library/progressing.rs b/services/headless-lms/models/src/library/progressing.rs index a69699874aa..30c0d3a4e22 100644 --- a/services/headless-lms/models/src/library/progressing.rs +++ b/services/headless-lms/models/src/library/progressing.rs @@ -567,7 +567,9 @@ pub async fn add_manual_completions( ) .await?; - if completion.grade > Some(5) || completion.grade < Some(0) { + if completion.grade.is_some() + && (completion.grade > Some(5) || completion.grade < Some(0)) + { return Err(ModelError::new( ModelErrorType::PreconditionFailed, "Invalid grade".to_string(),