]> git.mjollnir.org Git - moodle.git/commitdiff
Changes to make regrading work properly if the quiz has changed
authormoodler <moodler>
Thu, 20 Mar 2003 07:28:53 +0000 (07:28 +0000)
committermoodler <moodler>
Thu, 20 Mar 2003 07:28:53 +0000 (07:28 +0000)
and also an exptended timelimit for when regrading is REALLLLY slow
fue to some other unknown reason (as yet)

mod/quiz/lib.php
mod/quiz/report.php

index 8edeffc9520112f944660da13a4d23d88127e7d4..87f6565e85688d5f47fcb4fbd6c8347f64a94ea8 100644 (file)
@@ -300,7 +300,7 @@ function quiz_get_answers($question) {
 }
 
 
-function quiz_get_attempt_responses($attempt) {
+function quiz_get_attempt_responses($attempt, $quiz) {
 // Given an attempt object, this function gets all the 
 // stored responses and returns them in a format suitable
 // for regrading using quiz_grade_attempt_results()
@@ -310,7 +310,8 @@ function quiz_get_attempt_responses($attempt) {
                                         FROM {$CFG->prefix}quiz_responses r, 
                                              {$CFG->prefix}quiz_questions q
                                        WHERE r.attempt = '$attempt->id' 
-                                         AND q.id = r.question")) {
+                                         AND q.id = r.question
+                                         AND q.id IN ($quiz->questions)")) {
         notify("Could not find any responses for that attempt!");
         return false;
     }
index 13729e320f59c12ee466d6088de69da19df6768e..24e38f1cc250157dc98f9ddaf1ebc76841e1f8a4 100644 (file)
@@ -94,7 +94,7 @@
             }
         }
 
-        if (! $questions = quiz_get_attempt_responses($attempt)) {
+        if (! $questions = quiz_get_attempt_responses($attempt, $quiz)) {
             error("Could not reconstruct quiz results for attempt $attempt->id!");
         }
 
         $count->changed = 0;
         foreach ($attempts as $attempt) {
 
+            set_time_limit(120);
+
             if (!$attempt->timefinish) {  // Skip incomplete attempts
                 continue;
             }
 
             $count->attempt++;
 
-            if (! $questions = quiz_get_attempt_responses($attempt)) {
+            if (! $questions = quiz_get_attempt_responses($attempt, $quiz)) {
                 error("Could not reconstruct quiz results for attempt $attempt->id!");
             }