Quiz: Fix expected choice column for multiple answer dropdown - refs BT#20086

pull/4360/head
Angel Fernando Quiroz Campos 3 years ago
parent d123c3bb6d
commit 5235c0ee18
  1. 5
      main/inc/lib/exercise_show_functions.lib.php

@ -375,7 +375,8 @@ class ExerciseShowFunctions
foreach ($allChoices as $choice) { foreach ($allChoices as $choice) {
$isStudentAnswer = in_array($choice, $studentChoices); $isStudentAnswer = in_array($choice, $studentChoices);
$isCorrectAnswer = $isStudentAnswer && in_array($choice, $correctAnswers); $isExpectedAnswer = in_array($choice, $correctAnswers);
$isCorrectAnswer = $isStudentAnswer && $isExpectedAnswer;
$answerPosition = array_search($choice, $answer->iid); $answerPosition = array_search($choice, $answer->iid);
$hideExpectedAnswer = false; $hideExpectedAnswer = false;
@ -430,7 +431,7 @@ class ExerciseShowFunctions
if ($hideExpectedAnswer) { if ($hideExpectedAnswer) {
$html .= '<span class="text-muted">&mdash;</span>'; $html .= '<span class="text-muted">&mdash;</span>';
} else { } else {
$html .= $isCorrectAnswer ? $checkboxOn : $checkboxOff; $html .= $isExpectedAnswer ? $checkboxOn : $checkboxOff;
} }
$html .= '</td>'; $html .= '</td>';

Loading…
Cancel
Save