mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-30873 quiz: display an overall grade for preview users.
Also, don't display an overall grade unless there is at least one finished attempt.
This commit is contained in:
parent
2117dcb591
commit
ce70117bba
@ -94,7 +94,16 @@ if ($unfinishedattempt = quiz_get_user_attempt_unfinished($quiz->id, $USER->id))
|
||||
$numattempts = count($attempts);
|
||||
|
||||
// Work out the final grade, checking whether it was overridden in the gradebook.
|
||||
$mygrade = quiz_get_best_grade($quiz, $USER->id);
|
||||
if (!$canpreview) {
|
||||
$mygrade = quiz_get_best_grade($quiz, $USER->id);
|
||||
} else if ($lastfinishedattempt) {
|
||||
// Users who can preview the quiz don't get a proper grade, so work out a
|
||||
// plausible value to display instead, so the page looks right.
|
||||
$mygrade = quiz_rescale_grade($lastfinishedattempt->sumgrades, $quiz, false);
|
||||
} else {
|
||||
$mygrade = null;
|
||||
}
|
||||
|
||||
$mygradeoverridden = false;
|
||||
$gradebookfeedback = '';
|
||||
|
||||
@ -137,7 +146,7 @@ if ($attempts) {
|
||||
$viewobj->gradecolumn = $someoptions->marks >= question_display_options::MARK_AND_MAX &&
|
||||
quiz_has_grades($quiz);
|
||||
$viewobj->markcolumn = $viewobj->gradecolumn && ($quiz->grade != $quiz->sumgrades);
|
||||
$viewobj->overallstats = $alloptions->marks >= question_display_options::MARK_AND_MAX;
|
||||
$viewobj->overallstats = $lastfinishedattempt && $alloptions->marks >= question_display_options::MARK_AND_MAX;
|
||||
|
||||
$viewobj->feedbackcolumn = quiz_has_feedback($quiz) && $alloptions->overallfeedback;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user