Skip to content

Commit

Permalink
Exercise: Fix hide_expected_answer exercise option for fill in the bl…
Browse files Browse the repository at this point in the history
…ank question type - refs BT#21969
  • Loading branch information
NicoDucou committed Nov 18, 2024
1 parent 8bcf1c1 commit 2c779cb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
27 changes: 19 additions & 8 deletions main/exercise/fill_blanks.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,8 @@ public static function getHtmlDisplayForAnswer(
$answer,
$feedbackType,
$resultsDisabled = false,
$showTotalScoreAndUserChoices = false
$showTotalScoreAndUserChoices = false,
$exercise
) {
$result = '';
$listStudentAnswerInfo = self::getAnswerInfo($answer, true);
Expand All @@ -1215,15 +1216,17 @@ public static function getHtmlDisplayForAnswer(
$listStudentAnswerInfo['words'][$i],
$feedbackType,
$resultsDisabled,
$showTotalScoreAndUserChoices
$showTotalScoreAndUserChoices,
$exercise
);
} else {
$listStudentAnswerInfo['student_answer'][$i] = self::getHtmlWrongAnswer(
$listStudentAnswerInfo['student_answer'][$i],
$listStudentAnswerInfo['words'][$i],
$feedbackType,
$resultsDisabled,
$showTotalScoreAndUserChoices
$showTotalScoreAndUserChoices,
$exercise
);
}
}
Expand Down Expand Up @@ -1264,10 +1267,14 @@ public static function getHtmlAnswer(
$right,
$feedbackType,
$resultsDisabled = false,
$showTotalScoreAndUserChoices = false
$showTotalScoreAndUserChoices = false,
$exercise
) {
$hideExpectedAnswer = false;
$hideUserSelection = false;
if (!$exercise->showExpectedChoiceColumn()) {
$hideExpectedAnswer = true;
}
switch ($resultsDisabled) {
case RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS_AND_RANKING:
case RESULT_DISABLE_SHOW_ONLY_IN_CORRECT_ANSWER:
Expand Down Expand Up @@ -1356,15 +1363,17 @@ public static function getHtmlRightAnswer(
$correct,
$feedbackType,
$resultsDisabled = false,
$showTotalScoreAndUserChoices = false
$showTotalScoreAndUserChoices = false,
$exercise
) {
return self::getHtmlAnswer(
$answer,
$correct,
true,
$feedbackType,
$resultsDisabled,
$showTotalScoreAndUserChoices
$showTotalScoreAndUserChoices,
$exercise
);
}

Expand All @@ -1384,15 +1393,17 @@ public static function getHtmlWrongAnswer(
$correct,
$feedbackType,
$resultsDisabled = false,
$showTotalScoreAndUserChoices = false
$showTotalScoreAndUserChoices = false,
$exercise
) {
return self::getHtmlAnswer(
$answer,
$correct,
false,
$feedbackType,
$resultsDisabled,
$showTotalScoreAndUserChoices
$showTotalScoreAndUserChoices,
$exercise
);
}

Expand Down
3 changes: 2 additions & 1 deletion main/inc/lib/exercise_show_functions.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public static function display_fill_in_blanks_answer(
$answer,
$feedbackType,
$resultsDisabled,
$showTotalScoreAndUserChoices
$showTotalScoreAndUserChoices,
$exercise
);

if (empty($id)) {
Expand Down

0 comments on commit 2c779cb

Please sign in to comment.