]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12517 null not treated properly, max instead of min typo and pretty please initia...
authorskodak <skodak>
Tue, 18 Dec 2007 13:27:31 +0000 (13:27 +0000)
committerskodak <skodak>
Tue, 18 Dec 2007 13:27:31 +0000 (13:27 +0000)
grade/report/grader/lib.php

index d5f93b63b1a5973514a321e9a24da1397c301591..51af47b80036a2b4bd562a1fa9bd9bda352e4ddb 100644 (file)
@@ -199,15 +199,18 @@ class grade_report_grader extends grade_report {
                     $finalgrade = unformat_float($postedvalue);
                 }
 
-                // Warn if the grade is out of bounds.
                 $errorstr = '';
-                if ($finalgrade < $grade_item->grademax) {
+                // Warn if the grade is out of bounds.
+                if (is_null($finalgrade)) {
+                    // ok
+                } else if ($finalgrade < $grade_item->grademin) {
                     $errorstr = 'lessthanmin';
                 } else if ($finalgrade > $grade_item->grademax) {
                     $errorstr = 'morethanmax';
                 }
                 if ($errorstr) {
                     $user = get_record('user', 'id', $userid,'','','','','id, firstname, lastname');
+                    $gradestr = new object();
                     $gradestr->username = fullname($user);
                     $gradestr->itemname = $grade_item->get_name();
                     notify(get_string($errorstr, 'grades', $gradestr));