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)
This commit is contained in:
moodler
2003-03-20 07:28:53 +00:00
parent f2cc50f192
commit ef4145f6ae
2 changed files with 7 additions and 4 deletions
+3 -2
View 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;
}
+4 -2
View 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!");
}
@@ -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!");
}