From b169c31e397a670152b01aa3aed4fd879a906bb7 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Wed, 16 Aug 2006 16:54:20 +0000 Subject: [PATCH] Save two queries if we are not going to output anything. --- mod/quiz/report/overview/report.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index 0de139101b..beca8a4fd6 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -56,13 +56,13 @@ class quiz_report extends quiz_default_report { } // Print information on the number of existing attempts - if ($attemptnum = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0)) { - $a = new stdClass; - $a->attemptnum = $attemptnum; - $a->studentnum = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)'); - $a->studentstring = $course->students; + if (!$download) { //do not print notices when downloading + if ($attemptnum = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0)) { + $a = new stdClass; + $a->attemptnum = $attemptnum; + $a->studentnum = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)'); + $a->studentstring = $course->students; - if (!$download) { //do not print notices when downloading notify(get_string('numattempts', 'quiz', $a)); } } -- 2.39.5