MDL-31731 Advanced Grading: Marking Guide - prevent negative scores when marking...
[moodle.git] / grade / grading / form / guide / lib.php
index 7bd24e2..707fb37 100644 (file)
@@ -704,7 +704,8 @@ class gradingform_guide_instance extends gradingform_instance {
         foreach ($criteria as $id => $criterion) {
             if (!isset($elementvalue['criteria'][$id]['score'])
                     || $criterion['maxscore'] < $elementvalue['criteria'][$id]['score']
-                    || !is_numeric($elementvalue['criteria'][$id]['score'])) {
+                    || !is_numeric($elementvalue['criteria'][$id]['score'])
+                    || $elementvalue['criteria'][$id]['score'] < 0) {
                 $this->validationerrors[$id]['score'] =  $elementvalue['criteria'][$id]['score'];
             }
         }