-
Bug
-
Resolution: Fixed
-
Minor
-
2.6.3, 2.7
-
MOODLE_26_STABLE, MOODLE_27_STABLE
-
MOODLE_26_STABLE, MOODLE_27_STABLE
-
php docblock for get_num_selected_choices function says:
/**
|
* @param array $response responses, as returned by
|
* {@link question_attempt_step::get_qt_data()}.
|
* @return int the number of choices that were selected. in this response.
|
*/
|
But this is not working as expected because question_attempt_step::get_qt_data can return an array containing other elements than those related to choices, for instance the core qtype_multichoice_multi_question return an array with an '_order' element. So the count of selected answers is wrong by 1.
We need to filter such element discarting those where the name start with an underscore.