]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10581 - Each attemtp builds on last & multi-page quizzes was casuing grading...
authortjhunt <tjhunt>
Fri, 10 Aug 2007 15:22:28 +0000 (15:22 +0000)
committertjhunt <tjhunt>
Fri, 10 Aug 2007 15:22:28 +0000 (15:22 +0000)
lib/questionlib.php

index a3162906e2d948f1c78d8a9f354e12323f1f33cd..f6f7687aab7df2ebd2383606e66f083ce9bbdfd6 100644 (file)
@@ -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;