From ffc5a2c03a48c16d9ec270ce74b204c940064069 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 22 Oct 2002 10:56:48 +0000 Subject: [PATCH] More concise feedback on grading, and more efficiency (only update attempt grades that have changed) --- lang/en/quiz.php | 1 + mod/quiz/report.php | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lang/en/quiz.php b/lang/en/quiz.php index 49783a96c9..453a363adb 100644 --- a/lang/en/quiz.php +++ b/lang/en/quiz.php @@ -72,6 +72,7 @@ $string['quiznotavailable'] = "The quiz will not be available until: \$a"; $string['random'] = "Random set"; $string['regrade'] = "Regrade all attempts"; $string['regradecomplete'] = "All attempts have been regraded"; +$string['regradecount'] = "\$a->changed out of \$a->attempt grades were changed"; $string['rename'] = "Rename"; $string['report'] = "Reports"; $string['save'] = "Save"; diff --git a/mod/quiz/report.php b/mod/quiz/report.php index ac1b9d10e0..965a89f209 100644 --- a/mod/quiz/report.php +++ b/mod/quiz/report.php @@ -115,10 +115,16 @@ } $users = array(); + $count->attempt = 0; + $count->changed = 0; foreach ($attempts as $attempt) { + if (!$attempt->timefinish) { // Skip incomplete attempts continue; } + + $count->attempt++; + if (! $questions = quiz_get_attempt_responses($attempt)) { error("Could not reconstruct quiz results for attempt $attempt->id!"); } @@ -127,12 +133,13 @@ error("Could not re-grade this quiz attempt!"); } - echo "

$attempt->sumgrades --> $result->sumgrades

"; - $attempt->sumgrades = $result->sumgrades; + if ($attempt->sumgrades != $result->sumgrades) { + $attempt->sumgrades = $result->sumgrades; + $count->changed++; - if (! update_record("quiz_attempts", $attempt)) { - notify("Could not regrade attempt $attempt->id"); - continue; + if (! update_record("quiz_attempts", $attempt)) { + notify("Could not regrade attempt $attempt->id"); + } } $users[$attempt->user] = $attempt->user; @@ -146,6 +153,7 @@ } } print_heading(get_string("regradecomplete", "quiz")); + print_heading(get_string("regradecount", "quiz", $count)); print_continue("report.php?id=$cm->id"); print_footer($course); exit; -- 2.39.5