mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
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.
This commit is contained in:
parent
795ad63034
commit
2a1995a476
1 changed files with 4 additions and 5 deletions
|
@ -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 '<pre>';
|
||||
var_dump(compact('showgrades', 'quiz'));
|
||||
echo '</pre>';
|
||||
$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, ';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue