Skip to content

Commit 4b34950

Browse files
committed
Quiz: #fix user choice presentation in result page for Dragging question - refs BT#23132
1 parent acd49cc commit 4b34950

File tree

2 files changed

+6
-35
lines changed

2 files changed

+6
-35
lines changed

main/exercise/Draggable.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,9 @@ public function return_header(Exercise $exercise, $counter = null, $score = [])
215215
{
216216
$header = parent::return_header($exercise, $counter, $score);
217217
$header .= '<table class="'.$this->question_table_class.'"><tr>';
218-
219-
if ($exercise->showExpectedChoice()) {
220-
$header .= '<th>'.get_lang('YourChoice').'</th>';
221-
if ($exercise->showExpectedChoiceColumn()) {
222-
$header .= '<th>'.get_lang('ExpectedChoice').'</th>';
223-
}
224-
} else {
225-
$header .= '<th>'.get_lang('ElementList').'</th>';
226-
$header .= '<th>'.get_lang('YourChoice').'</th>';
218+
$header .= '<th>'.get_lang('ElementList').'</th>';
219+
$header .= '<th>'.get_lang('YourChoice').'</th>';
220+
if ($exercise->showExpectedChoice() || $exercise->showExpectedChoiceColumn()) {
227221
$header .= '<th>'.get_lang('ExpectedChoice').'</th>';
228222
}
229223
$header .= '<th>'.get_lang('Status').'</th>';

main/exercise/exercise.class.php

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5057,45 +5057,22 @@ function ($answerId) use ($objAnswerTmp) {
50575057
echo '</tr>';
50585058
break;
50595059
case DRAGGABLE:
5060-
if (false == $showTotalScoreAndUserChoicesInLastAttempt) {
5061-
$s_answer_label = '';
5062-
}
50635060
if (RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK == $this->results_disabled) {
50645061
if (false === $showTotalScoreAndUserChoicesInLastAttempt && empty($s_user_answer)) {
50655062
break;
50665063
}
50675064
}
50685065

50695066
echo '<tr>';
5070-
if ($this->showExpectedChoice()) {
5071-
if (!in_array($this->results_disabled, [
5072-
RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER,
5073-
//RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS_AND_RANKING,
5074-
])
5075-
) {
5076-
echo '<td>'.$user_answer.'</td>';
5077-
} else {
5078-
$status = Display::label(get_lang('Correct'), 'success');
5079-
}
5067+
if ($this->showExpectedChoice() || $this->showExpectedChoiceColumn()) {
50805068
echo '<td>'.$s_answer_label.'</td>';
5069+
echo '<td>'.$user_answer.'</td>';
5070+
echo '<td>'.$real_list[$i_answer_correct_answer].'</td>';
50815071
echo '<td>'.$status.'</td>';
50825072
} else {
50835073
echo '<td>'.$s_answer_label.'</td>';
50845074
echo '<td>'.$user_answer.'</td>';
5085-
echo '<td>'.$counterAnswer.'</td>';
50865075
echo '<td>'.$status.'</td>';
5087-
echo '<td>';
5088-
if (in_array($answerType, [MATCHING, MATCHING_COMBINATION, MATCHING_DRAGGABLE, MATCHING_DRAGGABLE_COMBINATION])) {
5089-
if (isset($real_list[$i_answer_correct_answer]) &&
5090-
$showTotalScoreAndUserChoicesInLastAttempt === true
5091-
) {
5092-
echo Display::span(
5093-
$real_list[$i_answer_correct_answer],
5094-
['style' => 'color: #008000; font-weight: bold;']
5095-
);
5096-
}
5097-
}
5098-
echo '</td>';
50995076
}
51005077
echo '</tr>';
51015078
break;

0 commit comments

Comments
 (0)