From fefcb951bc95bca7fe497f271476b21f3d2a1a09 Mon Sep 17 00:00:00 2001 From: Aparup Banerjee Date: Thu, 21 Jun 2012 11:03:30 +0800 Subject: [PATCH] MDL-26587 Question : fixed restoring shortanswer where answers are missing due to data error in mbz file. --- .../backup/moodle2/restore_qtype_shortanswer_plugin.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php b/question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php index 5dd1e86aadc..9f1b67b81bc 100644 --- a/question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php +++ b/question/type/shortanswer/backup/moodle2/restore_qtype_shortanswer_plugin.class.php @@ -68,8 +68,8 @@ class restore_qtype_shortanswer_plugin extends restore_qtype_plugin { $questioncreated = $this->get_mappingid('question_created', $oldquestionid) ? true : false; // If the question has been created by restore, we need to create its - // question_shortanswer too - if ($questioncreated) { + // question_shortanswer too, if they are defined (the gui should ensure this). + if ($questioncreated && !empty($data->answers)) { // Adjust some columns $data->question = $newquestionid; // Map sequence of question_answer ids