MDL-31731 Advanced Grading: Marking Guide - prevent negative scores when marking...
authorDan Marsden <dan@danmarsden.com>
Fri, 4 May 2012 07:26:16 +0000 (19:26 +1200)
committerDan Poltawski <dan@moodle.com>
Fri, 4 May 2012 08:20:50 +0000 (16:20 +0800)
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']
         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'];
             }
         }
                 $this->validationerrors[$id]['score'] =  $elementvalue['criteria'][$id]['score'];
             }
         }