Commit 16c7457f authored by Tim Hunt's avatar Tim Hunt
Browse files

MDL-36076 qtype multichoice: validation fails on '0' answer.

parent ecfe814e
...@@ -110,10 +110,10 @@ class qtype_multichoice_edit_form extends question_edit_form { ...@@ -110,10 +110,10 @@ class qtype_multichoice_edit_form extends question_edit_form {
//check no of choices //check no of choices
$trimmedanswer = trim($answer['text']); $trimmedanswer = trim($answer['text']);
$fraction = (float) $data['fraction'][$key]; $fraction = (float) $data['fraction'][$key];
if (empty($trimmedanswer) && empty($fraction)) { if ($trimmedanswer === '' && empty($fraction)) {
continue; continue;
} }
if (empty($trimmedanswer)) { if ($trimmedanswer === '') {
$errors['fraction['.$key.']'] = get_string('errgradesetanswerblank', 'qtype_multichoice'); $errors['fraction['.$key.']'] = get_string('errgradesetanswerblank', 'qtype_multichoice');
} }
......
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