]> git.mjollnir.org Git - moodle.git/commitdiff
Solved one bug when restoring RANDOMSAMATCH(6) questions if
authorstronk7 <stronk7>
Fri, 15 Aug 2003 18:10:11 +0000 (18:10 +0000)
committerstronk7 <stronk7>
Fri, 15 Aug 2003 18:10:11 +0000 (18:10 +0000)
they haven't been responsed in the quiz. The answer field in
quiz_responses must have X-0,Y-0 format instead of null.
Curiosly, MATCH(5) questions must have null if they aren'r
responsed.

mod/quiz/restorelib.php

index 19ab2bb1c58f7e2fe80ae349ca0691836651d514..9aa074497747b477ab18b0143a432690559d2c03 100644 (file)
                             $que = backup_getid($restore->backup_unique_code,"quiz_questions",$question_id);
                             //Get the answer from backup_ids
                             $ans = backup_getid($restore->backup_unique_code,"quiz_answers",$answer_id);
-                            if ($que and $ans) {
+                            if ($que) {
+                                //It the question hasn't response, it must be 0
+                                if (!$ans) {
+                                    $ans->new_id = 0;
+                                }
                                 if ($in_first) {
                                     $answer_field .= $que->new_id."-".$ans->new_id;
                                     $in_first = false;