MDL-47651 quiz responses: allow for qtypes without responses
authorTim Hunt <T.J.Hunt@open.ac.uk>
Mon, 13 Oct 2014 16:32:22 +0000 (17:32 +0100)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Mon, 20 Oct 2014 11:10:43 +0000 (12:10 +0100)
mod/quiz/report/responses/first_or_all_responses_table.php

index 1d91655..4a90a08 100644 (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) {