From a8958e3dfee822b04c280b19545ce906b86d6737 Mon Sep 17 00:00:00 2001 From: Matheus Zych Date: Wed, 29 Jan 2025 08:40:12 +0100 Subject: [PATCH] Fixes checkboxes of multiple choice question (multiple answers) not being checked in detailed evaluation view --- .../classes/class.assMultipleChoiceGUI.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Modules/TestQuestionPool/classes/class.assMultipleChoiceGUI.php b/Modules/TestQuestionPool/classes/class.assMultipleChoiceGUI.php index 8295abfdb5f3..0fd077552fbd 100755 --- a/Modules/TestQuestionPool/classes/class.assMultipleChoiceGUI.php +++ b/Modules/TestQuestionPool/classes/class.assMultipleChoiceGUI.php @@ -221,20 +221,15 @@ public function getSolutionOutput( $show_question_text = true, bool $show_inline_feedback = true ): string { - // shuffle output - $user_solution = []; - if ($active_id > 0 && !$show_correct_solution) { - $solutions = $this->object->getSolutionValues($active_id, $pass); + $user_solution = $this->object->getSolutionValues($active_id, $pass); } else { - // take the correct solution instead of the user solution + $user_solution = []; foreach ($this->object->answers as $index => $answer) { $points_checked = $answer->getPointsChecked(); $points_unchecked = $answer->getPointsUnchecked(); - if ($points_checked > $points_unchecked) { - if ($points_checked > 0) { - $user_solution[] = ['value1' => $index]; - } + if ($points_checked > $points_unchecked && $points_checked > 0) { + $user_solution[] = ['value1' => $index]; } } }