From: moodler Date: Thu, 20 Mar 2003 07:28:53 +0000 (+0000) Subject: Changes to make regrading work properly if the quiz has changed X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ef4145f6aecb6b8afc8b9fada4cf258880c9e00d;p=moodle.git Changes to make regrading work properly if the quiz has changed and also an exptended timelimit for when regrading is REALLLLY slow fue to some other unknown reason (as yet) --- diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index 8edeffc952..87f6565e85 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -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; } diff --git a/mod/quiz/report.php b/mod/quiz/report.php index 13729e320f..24e38f1cc2 100644 --- a/mod/quiz/report.php +++ b/mod/quiz/report.php @@ -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!"); } @@ -147,13 +147,15 @@ $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!"); }