Commit 8b9dfc2b authored by Tim Hunt's avatar Tim Hunt
Browse files

MDL-20636 Fix editing of multichoice questions.

parent ce5e4fb6
......@@ -486,8 +486,8 @@ abstract class question_edit_form extends moodleform {
foreach (array('correctfeedback', 'partiallycorrectfeedback', 'incorrectfeedback') as $feedbackname) {
$draftid = file_get_submitted_draft_itemid($feedbackname);
$question->$feedbackname = array();
$question->$feedbackname['text'] = file_prepare_draft_area(
$feedback = array();
$feedback['text'] = file_prepare_draft_area(
$draftid, // draftid
$this->context->id, // context
'qtype_multichoice', // component
......@@ -497,8 +497,10 @@ abstract class question_edit_form extends moodleform {
$question->options->$feedbackname // text
);
$feedbackformat = $feedbackname . 'format';
$question->$feedbackname['format'] = $question->options->$feedbackformat;
$question->$feedbackname['itemid'] = $draftid;
$feedback['format'] = $question->options->$feedbackformat;
$feedback['itemid'] = $draftid;
$question->$feedbackname = $feedback;
}
if ($withshownumcorrect) {
......@@ -531,9 +533,14 @@ abstract class question_edit_form extends moodleform {
$question->hint[$key]['itemid'] = $draftitemid;
$question->hint[$key]['format'] = $hint->hintformat;
$key++;
}
// TODO $withclearwrong, $withshownumpartscorrect
if ($withclearwrong) {
$question->hintclearwrong[] = $hint->clearwrong;
}
if ($withshownumpartscorrect) {
$question->hintshownumcorrect[] = $hint->shownumcorrect;
}
}
return $question;
}
......
......@@ -67,7 +67,7 @@ class question_edit_multichoice_form extends question_edit_form {
$question = parent::data_preprocessing($question);
$question = $this->data_preprocessing_answers($question, true);
$question = $this->data_preprocessing_combined_feedback($question, true);
$question = $this->data_preprocessing_hints($question);
$question = $this->data_preprocessing_hints($question, true, true);
if (!empty($question->options)) {
$question->single = $question->options->single;
......
......@@ -140,6 +140,8 @@ class qtype_multichoice extends question_type {
$DB->update_record('question_multichoice', $options);
$this->save_hints($question, true);
/// Perform sanity checks on fractional grades
if ($options->single) {
if ($maxfraction != 1) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment