From f552665ebfe545ac25f8d960ef64b2c61af8190a Mon Sep 17 00:00:00 2001 From: Vasilis Daloukas Date: Thu, 31 Dec 2015 00:00:30 +0200 Subject: [PATCH] Fixing how is shows multichoice question on show answers. --- CHANGES.md | 1 + showanswers.php | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index fabd914..ec1a088 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,7 @@ Changes in version 3.36.31.1 (2015123101) - Fix at backup. - Fix not to show how many correct letters are when printing the crossword. - Moodle 3.1 compatibility. +- Fixing how is shows multichoice question on show answers. Changes in version 3.36.30.1 (2015123001) ------------------------------------------------------------------ diff --git a/showanswers.php b/showanswers.php index cdf1a08..0951133 100755 --- a/showanswers.php +++ b/showanswers.php @@ -206,7 +206,7 @@ function game_showanswers_quiz( $game, $context) { $table = '{question} q,{quiz_question_instances} qqi'; } else { $select = "qs.quizid='$game->quizid' ". - " AND qs.questionid=q.id"; + " AND qs.questionid=q.id ".game_showanswers_appendselect( $game); $table = "{question} q,{quiz_slots} qs"; } @@ -313,21 +313,17 @@ function game_showanswers_question_select( $game, $table, $select, $fields, $ord foreach ($recs as $rec) { if ($i++ > 0) { echo '
'; - if ($rec->fraction == 1) { - echo " $rec->answer"; - if ($rec->feedback == '') { - $feedback .= '
'; - } - } else { - $feedback .= "$rec->feedback
"; - } + } + if ($rec->fraction == 1) { + echo " $rec->answer"; } else { echo " $rec->answer"; - if ($rec->feedback == '') { - $feedback .= '
'; - } else { - $feedback .= "
"; - } + } + + if ($rec->feedback == '') { + $feedback .= '
'; + } else { + $feedback .= "{$rec->feedback}
"; } } echo '';