Merge pull request #4133 from christianbeeznest/orouba-19383

Exercise - Add extra columns to show choice in results for draggable question - refs BT#19383
pull/4141/head
Nicolas Ducoulombier 4 years ago committed by GitHub
commit ae25ebbb25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      main/exercise/Draggable.php
  2. 9
      main/exercise/exercise.class.php
  3. 3
      main/exercise/matching.class.php

@ -223,6 +223,8 @@ class Draggable extends Question
}
} else {
$header .= '<th>'.get_lang('ElementList').'</th>';
$header .= '<th>'.get_lang('YourChoice').'</th>';
$header .= '<th>'.get_lang('ExpectedChoice').'</th>';
}
$header .= '<th>'.get_lang('Status').'</th>';
$header .= '</tr>';

@ -4705,12 +4705,17 @@ class Exercise
if (!empty($s_user_answer)) {
if (DRAGGABLE == $answerType) {
$sql = "SELECT answer FROM $table_ans WHERE iid = $s_user_answer";
$rsDragAnswer = Database::query($sql);
$dragAns = Database::result($rsDragAnswer, 0, 0);
if ($s_user_answer == $i_answer_correct_answer) {
$questionScore += $i_answerWeighting;
$totalScore += $i_answerWeighting;
$user_answer = Display::label(get_lang('Correct'), 'success');
if ($this->showExpectedChoice() && !empty($i_answer_id)) {
$user_answer = $answerMatching[$i_answer_id];
} else {
$user_answer = $dragAns;
}
$status = Display::label(get_lang('Correct'), 'success');
} else {
@ -4719,6 +4724,8 @@ class Exercise
/*$data = $options[$real_list[$s_user_answer] - 1];
$user_answer = $data['answer'];*/
$user_answer = $correctAnswers[$s_user_answer] ?? '';
} else {
$user_answer = $dragAns;
}
}
} else {
@ -4866,6 +4873,8 @@ class Exercise
} else {
echo '<td>'.$s_answer_label.'</td>';
echo '<td>'.$user_answer.'</td>';
echo '<td>'.$counterAnswer.'</td>';
echo '<td>'.$status.'</td>';
echo '<td>';
if (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) {
if (isset($real_list[$i_answer_correct_answer]) &&

@ -293,6 +293,9 @@ class Matching extends Question
}
if ($exercise->showExpectedChoice()) {
if ($exercise->showExpectedChoiceColumn()) {
$header .= '<th>'.get_lang('ExpectedChoice').'</th>';
}
$header .= '<th>'.get_lang('Status').'</th>';
} else {
if ($exercise->showExpectedChoiceColumn()) {

Loading…
Cancel
Save