MDL-34532 quiz reports: error when showing users without attempts.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Thu, 26 Jul 2012 09:07:09 +0000 (10:07 +0100)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Fri, 27 Jul 2012 22:21:32 +0000 (23:21 +0100)
We were not checking if attempt state was null before trying to convert it to a string.

mod/quiz/report/attemptsreport_table.php

index 4334256..f119da0 100644 (file)
@@ -152,7 +152,11 @@ abstract class quiz_attempts_report_table extends table_sql {
      * @return string HTML content to go inside the td.
      */
     public function col_state($attempt) {
-        return quiz_attempt::state_name($attempt->state);
+        if (!is_null($attempt->attempt)) {
+            return quiz_attempt::state_name($attempt->state);
+        } else {
+            return  '-';
+        }
     }
 
     /**