]> git.mjollnir.org Git - moodle.git/commitdiff
More concise feedback on grading, and more efficiency (only update
authormoodler <moodler>
Tue, 22 Oct 2002 10:56:48 +0000 (10:56 +0000)
committermoodler <moodler>
Tue, 22 Oct 2002 10:56:48 +0000 (10:56 +0000)
attempt grades that have changed)

lang/en/quiz.php
mod/quiz/report.php

index 49783a96c9fe808f2294177e6f2c5067ce71906f..453a363adb8862538078e9f97f4d1504d3907e6c 100644 (file)
@@ -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";
index ac1b9d10e06b3e3b454841f50e0aba924b8665e4..965a89f2096f2ce1d075a3e04ceaa714bddc1e00 100644 (file)
         }
 
         $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!");
             }
                 error("Could not re-grade this quiz attempt!");
             }
 
-            echo "<P ALIGN=center>$attempt->sumgrades --> $result->sumgrades</P>";
-            $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;
             }
         }   
         print_heading(get_string("regradecomplete", "quiz"));
+        print_heading(get_string("regradecount", "quiz", $count));
         print_continue("report.php?id=$cm->id");
         print_footer($course);
         exit;