Open leozelion opened 3 years ago
Yes, this is a bug, and the necessary fix will be something like that. Patches welcome if you have time.
mod/quiz/report/answersheets/classes/output/multichoice/renderer.php
inherits from qtype_multichoice_single_renderer
but you can overwrite the question type if you insert following lines, right after you get the input attributes:
global $DB;
$questionid = $qa->get_question_id();
$specific_type = $DB->get_record('qtype_multichoice_options', ['questionid' => $questionid], 'single', MUST_EXIST);
if ($specific_type->single == 0){
$inputattributes['type'] = 'checkbox';
}
This fix renders a radio button if it is a single multichoice and renders a checkbox if it is not a single multichoice.
I created a pull request on this issue: https://github.com/moodleou/moodle-quiz_answersheets/pull/32
Hi! The class
qtype_multichoice_override_renderer
extends coreqtype_multichoice_single_renderer
and can only render multichoice question with single right answer, so every question renders with radio-inputs. As an option, you can extendqtype_multichoice_multi_renderer
class below and add condition inutils::get_question_renderer()