From 887e908592e4d84cb2e3d28020025480e91c7c77 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Fri, 15 Aug 2003 18:10:11 +0000 Subject: [PATCH] Solved one bug when restoring RANDOMSAMATCH(6) questions if 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mod/quiz/restorelib.php b/mod/quiz/restorelib.php index 19ab2bb1c5..9aa0744977 100644 --- a/mod/quiz/restorelib.php +++ b/mod/quiz/restorelib.php @@ -1040,7 +1040,11 @@ $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; -- 2.39.5