Permalink
Browse files

Merge branch 'MDL-30742_22' of git://github.com/timhunt/moodle into M…

…OODLE_22_STABLE
  • Loading branch information...
2 parents 2253ea2 + 51d8616 commit 265dbb3a54ae80744bef3de28b1d0b7b4df5a04e Sam Hemelryk committed Dec 18, 2011
@@ -50,6 +50,21 @@ public function process_question(array $data, array $raw) {
}
// convert and write the multichoice
+ if (!isset($data['multichoice'])) {
+ // This should never happen, but it can do if the 1.9 site contained
+ // corrupt data/
+ $data['multichoice'] = array(array(
+ 'single' => 1,
+ 'shuffleanswers' => 1,
+ 'correctfeedback' => '',
+ 'correctfeedbackformat' => FORMAT_HTML,
+ 'partiallycorrectfeedback' => '',
+ 'partiallycorrectfeedbackformat' => FORMAT_HTML,
+ 'incorrectfeedback' => '',
+ 'incorrectfeedbackformat' => FORMAT_HTML,
+ 'answernumbering' => 'abc',
+ ));
+ }
$this->write_multichoice($data['multichoice'], $data['oldquestiontextformat']);
}
@@ -73,7 +73,11 @@ public function process_multichoice($data) {
// Adjust some columns
$data->question = $newquestionid;
// Map sequence of question_answer ids
- $answersarr = explode(',', $data->answers);
+ if ($data->answers) {
+ $answersarr = explode(',', $data->answers);
+ } else {
+ $answersarr = array();
+ }
foreach ($answersarr as $key => $answer) {
$answersarr[$key] = $this->get_mappingid('question_answer', $answer);
}

0 comments on commit 265dbb3

Please sign in to comment.