]> git.mjollnir.org Git - moodle.git/commitdiff
Save two queries if we are not going to output anything.
authortjhunt <tjhunt>
Wed, 16 Aug 2006 16:54:20 +0000 (16:54 +0000)
committertjhunt <tjhunt>
Wed, 16 Aug 2006 16:54:20 +0000 (16:54 +0000)
mod/quiz/report/overview/report.php

index 0de139101b8903723dfc8b033efbd50b56e65313..beca8a4fd672d6793b08b9158798ec7ecb88cec6 100644 (file)
@@ -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));
             }
         }