Skip to content
Permalink
Browse files

Merge branch 'MDL-64941-master' of https://github.com/MartinGauk/moodle

  • Loading branch information...
abgreeve committed Mar 5, 2019
2 parents e93b9cb + 3e24d6f commit 10ed5197fd2cdd72cad04515307fef20f27a9a91
Showing with 11 additions and 5 deletions.
  1. +11 −5 question/type/multianswer/questiontype.php
@@ -91,12 +91,18 @@ public function save_question_options($question) {
// will also create difficulties if questiontype specific tables reference the id.
// First we get all the existing wrapped questions.
if (!$oldwrappedids = $DB->get_field('question_multianswer', 'sequence',
$oldwrappedquestions = [];
if ($oldwrappedids = $DB->get_field('question_multianswer', 'sequence',
array('question' => $question->id))) {
$oldwrappedquestions = array();
} else {
$oldwrappedquestions = $DB->get_records_list('question', 'id',
explode(',', $oldwrappedids), 'id ASC');
$oldwrappedidsarray = explode(',', $oldwrappedids);
$unorderedquestions = $DB->get_records_list('question', 'id', $oldwrappedidsarray);
// Keep the order as given in the sequence field.
foreach ($oldwrappedidsarray as $questionid) {
if (isset($unorderedquestions[$questionid])) {
$oldwrappedquestions[] = $unorderedquestions[$questionid];
}
}
}
$sequence = array();

0 comments on commit 10ed519

Please sign in to comment.
You can’t perform that action at this time.