MDL-28103 code to deal with missing question_attempts was buggy.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Fri, 1 Jul 2011 19:58:39 +0000 (20:58 +0100)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Fri, 1 Jul 2011 20:07:49 +0000 (21:07 +0100)
question/engine/upgrade/behaviourconverters.php
question/engine/upgrade/upgradelib.php

index 881036e..9fffa19 100644 (file)
@@ -112,7 +112,7 @@ abstract class question_behaviour_attempt_updater {
         $step->state = 'todo';
         $step->data = array();
         $step->fraction = null;
-        $step->timecreated = $this->attempt->timestart;
+        $step->timecreated = $this->attempt->timestart ? $this->attempt->timestart : time();
         $step->userid = $this->attempt->userid;
         $this->qtypeupdater->supply_missing_first_step_data($step->data);
         return $step;
index 21b1c67..ed97f21 100644 (file)
@@ -209,6 +209,7 @@ class question_engine_attempt_upgrader {
                         question {$questionid} in attempt {$attempt->id} at quiz
                         {$attempt->quiz}, since the session was missing.", $attempt->id);
                 try {
+                    $question = $this->load_question($questionid, $quiz->id);
                     $qas[$questionid] = $this->supply_missing_question_attempt(
                             $quiz, $attempt, $question);
                 } catch (Exception $e) {