Exercises: Show attempt results for student + show complete result

in last attempt, if result disabled value is:

RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK

BT#18025
pull/3745/head^2
Julio 5 years ago
parent b6b57d2de5
commit 0c6fb15725
  1. 2
      main/exercise/overview.php
  2. 16
      main/inc/lib/exercise.lib.php

@ -231,7 +231,7 @@ if (in_array(
$objExercise->results_disabled,
[
RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT,
RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK,
//RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK,
RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK,
])
) {

@ -4658,6 +4658,22 @@ EOT;
if ($numberAttempts >= $objExercise->attempts) {
$showTotalScoreAndUserChoicesInLastAttempt = true;
}
// Check if the current attempt is the last.
if (false === $save_user_result && !empty($attempts)) {
$showTotalScoreAndUserChoicesInLastAttempt = false;
$position = 1;
foreach ($attempts as $attempt) {
if ($exeId == $attempt['exe_id']) {
break;
}
$position++;
}
if ($position == $objExercise->attempts) {
$showTotalScoreAndUserChoicesInLastAttempt = true;
}
}
}
}

Loading…
Cancel
Save