diff --git a/src/qtism/runtime/tests/AssessmentItemSession.php b/src/qtism/runtime/tests/AssessmentItemSession.php index b36fedf11..47fd23051 100644 --- a/src/qtism/runtime/tests/AssessmentItemSession.php +++ b/src/qtism/runtime/tests/AssessmentItemSession.php @@ -1293,6 +1293,15 @@ private function mustModalFeedback() // This [showFeedback] constraint affects the visibility of feedback after the end of the last attempt. If it // is false then feedback is not shown. This includes both Modal Feedback and Integrated Feedback even if the // candidate has access to the review state. The default is false. + // + // QTI-SDK Developers: + // The following sentence from the specification is problematic: "A value of maxAttempts greater than 1, by definition, + // indicates that any applicable feedback must be shown." In other words, we can read that if the value of maxAttempts + // is lesser or equal to 1, no feedback must be shown. This is very problematic in case of a linear test, where it is logic + // to set the maxAttempts to 1, because the number of attempts is defacto 1 in such a linear test. In such a context, no + // feedbacks can be shown. QTI-SDK Developers decided that it was more sensitive to show feedbacks if maxAttempts is lesser + // or equal to 1. However, "once the maximum number of allowed attempts have been used whether or not the feeback is shown + // is still controlled by the showFeedback constraint. $mustModalFeedback = false; $itemSessionControl = $this->getItemSessionControl(); @@ -1301,13 +1310,7 @@ private function mustModalFeedback() return $mustModalFeedback; } - // Feedback is never shown in SIMULTANEOUS submission mode, nor if showFeedback is disabled. - $maxAttempts = $itemSessionControl->getMaxAttempts(); - if ($this->getAssessmentItem()->isAdaptive() === true) { - $maxAttempts = 0; - } - - if (($maxAttempts === 0 || $maxAttempts > 1) && $this->getSubmissionMode() === SubmissionMode::INDIVIDUAL) { + if ($this->getSubmissionMode() === SubmissionMode::INDIVIDUAL) { foreach ($this->getAssessmentItem()->getModalFeedbackRules() as $rule) { diff --git a/test/qtismtest/runtime/tests/AssessmentTestSessionTest.php b/test/qtismtest/runtime/tests/AssessmentTestSessionTest.php index ade77ccd7..6876a49d8 100644 --- a/test/qtismtest/runtime/tests/AssessmentTestSessionTest.php +++ b/test/qtismtest/runtime/tests/AssessmentTestSessionTest.php @@ -1390,11 +1390,15 @@ public function testItemModalFeedbacks() { $session->beginAttempt(); $responses = new State(array(new ResponseVariable('RESPONSE', Cardinality::SINGLE, BaseType::IDENTIFIER, new QtiIdentifier('true')))); $session->endAttempt($responses); - // The ModalFeedback must not be shown because the number of attempts is not > 1. - $this->assertEquals(AssessmentItemSessionState::CLOSED, $session->getCurrentAssessmentItemSession()->getState()); + // The ModalFeedback must be shown because even if the last attempt has been consumed, showFeedback is true. + $this->assertEquals(AssessmentItemSessionState::MODAL_FEEDBACK, $session->getCurrentAssessmentItemSession()->getState()); // -- Move from Q01 to Q02. + $tempItemSession = $session->getCurrentAssessmentItemSession(); $session->moveNext(); + + // Just check that Q01 closed. + $this->assertEquals(AssessmentItemSessionState::CLOSED, $tempItemSession->getState()); // -- Q02 nonAdaptive, maxAttempts = 0, showFeedback = false. // Here, the maxAttempts is 0 i.e. no limit. Moreover, feedback is shown only if the answer is wrong.