-
Bug
-
Resolution: Fixed
-
Minor
-
4.4
Today I hit a bug in mod/quiz/index.php when a specific condition was met:
if ($alloptions->marks >= question_display_options::MARK_AND_MAX)
if ($quiz->grade && array_key_exists($quiz->id, $grades)) { |
if ($alloptions->marks >= question_display_options::MARK_AND_MAX) { |
$grade = $OUTPUT->render(new grade_out_of( |
$grades[$quiz->id], $quiz->grade, $quiz->sumgrades, style: grade_out_of::SHORT));
|
}
|
if ($alloptions->overallfeedback) { |
$feedback = quiz_feedback_for_grade($grades[$quiz->id], $quiz, $context);
|
}
|
}
|
|
After quick inspection it looks like the call to constructor of grade_out_of() class is not upgraded, as it is in for example grade_calculator class.
I would gladly ask for help here.
Last time the code in question was modified as result of work in MDL-74610 - see:
https://github.com/moodle/moodle/commit/ba40067746198abe8edd35126aa461e9030451fa#diff-b5810793be844eb2e6b59537376c0e467a0d4bde989ce254df3d225c7593f08c
Reported exception:
Exception - mod_quiz\output\grades\grade_out_of::__construct():
|
Argument #1 ($quiz) must be of type stdClass, string given,
|
called in [dirroot]/mod/quiz/index.php on line 166
|
Stack trace:
|
line 50 of /mod/quiz/classes/output/grades/grade_out_of.php: TypeError thrown
|
line 166 of /mod/quiz/index.php: call to mod_quiz\output\grades\grade_out_of->__construct()
|