MDL-34532 quiz reports: error when showing users without attempts.

We were not checking if attempt state was null before trying to convert it to a string.
This commit is contained in:
Tim Hunt
2012-07-27 23:21:32 +01:00
parent 55a568fa7d
commit f8b665224f
+5 -1
View 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 '-';
}
}
/**