From: jamiesensei Date: Mon, 15 Sep 2008 13:38:31 +0000 (+0000) Subject: MDL-16362 "Quiz - bar graph on results screen" there was a bug in my code that would... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2a1995a4765bd0596915f18b6079122dd759d482;p=moodle.git MDL-16362 "Quiz - bar graph on results screen" there was a bug in my code that would put the graph generation code into an infinite loop if the overall grade for the quiz is 0. Since the change in the type of the field for quiz->grade the old test for quiz->grade being zero doesn't work. Using $quiz->grade as a bool does not work ($quiz->grade is now a string 0.0000), since Moodle 2.0 need to use $quiz->grade == 0. --- diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index d82e4f8c48..db309082ba 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -29,8 +29,10 @@ class quiz_overview_report extends quiz_default_report { $fakeattempt->timefinish = $quiz->timeopen; $fakeattempt->userid = 0; $reviewoptions = quiz_get_reviewoptions($quiz, $fakeattempt, $this->context); - $showgrades = $quiz->grade && $quiz->sumgrades && $reviewoptions->scores; - + $showgrades = ($quiz->grade !== 0) && ($quiz->sumgrades !== 0) && $reviewoptions->scores; + echo '
';
+        var_dump(compact('showgrades', 'quiz'));
+        echo '
'; $download = optional_param('download', '', PARAM_ALPHA); /// find out current groups mode @@ -207,9 +209,6 @@ class quiz_overview_report extends quiz_default_report { if (!$nostudents || ($attemptsmode == QUIZ_REPORT_ATTEMPTS_ALL)){ - $showgrades = $quiz->grade && $quiz->sumgrades && $reviewoptions->scores; - $hasfeedback = quiz_has_feedback($quiz->id) && $quiz->grade > 1.e-7 && $quiz->sumgrades > 1.e-7; - // Construct the SQL $fields = $DB->sql_concat('u.id', '\'#\'', 'COALESCE(qa.attempt, \'0\')').' AS uniqueid, ';