From f16ed06c2ca2ed247aa6f564bab23f03040e9f51 Mon Sep 17 00:00:00 2001 From: Jamie Pratt Date: Wed, 16 Oct 2013 19:40:04 +0700 Subject: [PATCH] MDL-42115 exception when there are no questions --- mod/quiz/report/statistics/report.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mod/quiz/report/statistics/report.php b/mod/quiz/report/statistics/report.php index 3cc1e2a7d9a..d8e09e7ff14 100644 --- a/mod/quiz/report/statistics/report.php +++ b/mod/quiz/report/statistics/report.php @@ -54,6 +54,12 @@ class quiz_statistics_report extends quiz_default_report { $this->context = context_module::instance($cm->id); + if (!quiz_questions_in_quiz($quiz->questions)) { + $this->print_header_and_tabs($cm, $course, $quiz, 'statistics'); + echo quiz_no_questions_message($quiz, $cm, $this->context); + return true; + } + // Work out the display options. $download = optional_param('download', '', PARAM_ALPHA); $everything = optional_param('everything', 0, PARAM_BOOL); @@ -151,9 +157,7 @@ class quiz_statistics_report extends quiz_default_report { } } - if (!quiz_questions_in_quiz($quiz->questions)) { - echo quiz_no_questions_message($quiz, $cm, $this->context); - } else if (!$this->table->is_downloading() && $quizstats->s() == 0) { + if (!$this->table->is_downloading() && $quizstats->s() == 0) { echo $OUTPUT->notification(get_string('noattempts', 'quiz')); }