Skip to content

Commit

Permalink
Modal feedback can be shown even if maxAttempts = 1.
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Apr 28, 2016
1 parent c2b8204 commit b52cae2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
17 changes: 10 additions & 7 deletions src/qtism/runtime/tests/AssessmentItemSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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) {

Expand Down
8 changes: 6 additions & 2 deletions test/qtismtest/runtime/tests/AssessmentTestSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b52cae2

Please sign in to comment.