MDL-33853: Prevent locking an assignment submission from putting a grade of 0 in...
authorDamyon Wiese <damyon.wiese@netspot.com.au>
Tue, 19 Jun 2012 15:48:39 +0000 (23:48 +0800)
committerAparup Banerjee <aparup@moodle.com>
Fri, 22 Jun 2012 03:12:06 +0000 (11:12 +0800)
mod/assign/gradingtable.php
mod/assign/locallib.php

index 9e1c9ce..abd5b72 100644 (file)
@@ -373,7 +373,7 @@ class assign_grading_table extends table_sql implements renderable {
     function col_timemarked(stdClass $row) {
         $o = '-';
 
     function col_timemarked(stdClass $row) {
         $o = '-';
 
-        if ($row->timemarked) {
+        if ($row->timemarked && $row->grade !== NULL && $row->grade >= 0) {
             $o = userdate($row->timemarked);
         }
 
             $o = userdate($row->timemarked);
         }
 
index df4e4a2..28e8830 100644 (file)
@@ -2121,7 +2121,9 @@ class assign {
         // trying to match those array keys in grade update function in gradelib.php
         // with keys in th database table assign_grades
         // starting around line 262
         // trying to match those array keys in grade update function in gradelib.php
         // with keys in th database table assign_grades
         // starting around line 262
-        $gradebookgrade['rawgrade'] = $grade->grade;
+        if ($grade->grade >= 0) {
+            $gradebookgrade['rawgrade'] = $grade->grade;
+        }
         $gradebookgrade['userid'] = $grade->userid;
         $gradebookgrade['usermodified'] = $grade->grader;
         $gradebookgrade['datesubmitted'] = NULL;
         $gradebookgrade['userid'] = $grade->userid;
         $gradebookgrade['usermodified'] = $grade->grader;
         $gradebookgrade['datesubmitted'] = NULL;