MDL-47651 quiz responses: allow for qtypes without responses

This commit is contained in:
Tim Hunt 2014-10-13 17:32:22 +01:00
parent b49de5d930
commit a40eaaa28f

View File

@ -132,6 +132,10 @@ class quiz_first_or_all_responses_table extends quiz_last_responses_table {
*/
public function get_summary_after_try($tablerow, $slot) {
$qa = $this->get_question_attempt($tablerow->usageid, $slot);
if (!($qa->get_question() instanceof question_manually_gradable)) {
// No responses, and we cannot call summarise_response below.
return null;
}
$submissionsteps = $qa->get_steps_with_submitted_response_iterator();
$step = $submissionsteps[$tablerow->try];
if ($step === null) {