From d402153a54cdfb82173b4f745bf5aeec62e9e2e7 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Fri, 10 Aug 2007 15:22:28 +0000 Subject: [PATCH] MDL-10581 - Each attemtp builds on last & multi-page quizzes was casuing grading errors. Merged from MOODLE_18_STABLE. --- lib/questionlib.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/questionlib.php b/lib/questionlib.php index a3162906e2..f6f7687aab 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -687,28 +687,25 @@ function get_question_states(&$questions, $cmoptions, $attempt, $lastattemptid = } // Restore the state so that the responses will be restored restore_question_state($questions[$i], $laststate); - $states[$i] = clone ($laststate); + $states[$i] = clone($laststate); } else { - // create a new empty state - $states[$i] = new object; + // create a new empty state + $states[$i] = new object; + $states[$i]->question = $i; + $states[$i]->responses = array('' => ''); + $states[$i]->raw_grade = 0; } // now fill/overide initial values $states[$i]->attempt = $attempt->uniqueid; - $states[$i]->question = (int) $i; $states[$i]->seq_number = 0; $states[$i]->timestamp = $attempt->timestart; $states[$i]->event = ($attempt->timefinish) ? QUESTION_EVENTCLOSE : QUESTION_EVENTOPEN; $states[$i]->grade = 0; - $states[$i]->raw_grade = 0; $states[$i]->penalty = 0; $states[$i]->sumpenalty = 0; $states[$i]->manualcomment = ''; - // if building on last attempt we want to preserve responses - if (!$lastattemptid) { - $states[$i]->responses = array('' => ''); - } // Prevent further changes to the session from incrementing the // sequence number $states[$i]->changed = true; -- 2.39.5