Skip to content

Commit

Permalink
Merge branch 'MDL-51855-master' of git://github.com/lameze/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Oct 26, 2015
2 parents f7d8c61 + abc2491 commit eb154d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ public function after_execute_question() {
question_bank::get_qtype($wrapped->qtype)->get_question_options($wrapped);
if (isset($wrapped->options->shuffleanswers)) {
preg_match('/'.ANSWER_REGEX.'/s', $wrapped->questiontext, $answerregs);
if ($answerregs[ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE] != '' ) {
if (isset($answerregs[ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE]) &&
$answerregs[ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE] !== '') {
$wrapped->options->shuffleanswers = 0;
$DB->set_field_select('qtype_multichoice_options', 'shuffleanswers', '0', "id =:select",
array('select' => $wrapped->options->id) );
Expand Down
3 changes: 2 additions & 1 deletion question/type/multianswer/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ function xmldb_qtype_multianswer_upgrade($oldversion) {
$options = $DB->get_record('qtype_multichoice_options', array('questionid' => $wrapped->id), '*');
if (isset($options->shuffleanswers)) {
preg_match('/'.ANSWER_REGEX.'/s', $wrapped->questiontext, $answerregs);
if ($answerregs[ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE] != '' ) {
if (isset($answerregs[ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE]) &&
$answerregs[ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE] !== '') {
$DB->set_field('qtype_multichoice_options', 'shuffleanswers', '0',
array('id' => $options->id) );
}
Expand Down

0 comments on commit eb154d9

Please sign in to comment.