MDL-10581 - Each attemtp builds on last & multi-page quizzes was casuing grading errors.

This commit is contained in:
tjhunt
2007-08-10 15:22:15 +00:00
parent 1c5d61d928
commit a44ce185fa
+7 -11
View File
@@ -10,7 +10,6 @@
* TODO: separate those functions which form part of the API
* from the helper functions.
*
* @version $Id$
* @author Martin Dougiamas and many others. This has recently been completely
* rewritten by Alex Smith, Julian Sedding and Gustav Delius as part of
* the Serving Mathematics project
@@ -696,28 +695,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;
@@ -733,7 +729,7 @@ function get_question_states(&$questions, $cmoptions, $attempt, $lastattemptid =
question_process_responses($questions[$i], $states[$i], $action, $cmoptions, $attempt);
// Fix for Bug #5506: When each attempt is built on the last one,
// preserve the options from any previous attempt.
// preserve the options from any previous attempt.
if ( isset($laststate->options) ) {
$states[$i]->options = $laststate->options;
}