MDL-33878: Assignment - prevent error when removing overridden flag in gradebook
authorDamyon Wiese <damyon.wiese@netspot.com.au>
Wed, 20 Jun 2012 05:11:19 +0000 (13:11 +0800)
committerDamyon Wiese <damyon.wiese@netspot.com.au>
Wed, 20 Jun 2012 05:11:19 +0000 (13:11 +0800)
This error only occurs when there is a submission but no grade in the assignment
and the feedback comments plugin is enabled.

mod/assign/locallib.php

index a7466d1..df4e4a2 100644 (file)
@@ -3349,8 +3349,10 @@ class assign {
             // now get the feedback
             if ($gradebookplugin) {
                 $grade = $this->get_user_grade($result->userid, false);
-                $gradebookgrade->feedbacktext = $gradebookplugin->text_for_gradebook($grade);
-                $gradebookgrade->feedbackformat = $gradebookplugin->format_for_gradebook($grade);
+                if ($grade) {
+                    $gradebookgrade->feedbacktext = $gradebookplugin->text_for_gradebook($grade);
+                    $gradebookgrade->feedbackformat = $gradebookplugin->format_for_gradebook($grade);
+                }
             }
             $grades[$gradebookgrade->userid] = $gradebookgrade;
         }