diff --git a/src/qtism/runtime/storage/binary/AbstractQtiBinaryStorage.php b/src/qtism/runtime/storage/binary/AbstractQtiBinaryStorage.php index 1df0c7d90..d17ebaea0 100644 --- a/src/qtism/runtime/storage/binary/AbstractQtiBinaryStorage.php +++ b/src/qtism/runtime/storage/binary/AbstractQtiBinaryStorage.php @@ -332,15 +332,14 @@ public function retrieve($sessionId) // Build the duration store. $durationStore = new DurationStore(); - $durationCount = $access->readShort(); - for ($i = 0; $i < $durationCount; $i++) { - $varName = $access->readString(); - $durationVariable = new OutcomeVariable($varName, Cardinality::SINGLE, BaseType::DURATION); - $access->readVariableValue($durationVariable); - $durationStore->setVariable($durationVariable); - } - - $assessmentTestSession->setDurationStore($durationStore); + $durationCount = $access->readShort(); + for ($i = 0; $i < $durationCount; $i++) { + $varName = $access->readString(); + $durationVariable = new OutcomeVariable($varName, Cardinality::SINGLE, BaseType::DURATION); + $access->readVariableValue($durationVariable); + $durationStore->setVariable($durationVariable); + } + $assessmentTestSession->setDurationStore($durationStore); $stream->close(); diff --git a/src/qtism/runtime/tests/AssessmentTestSession.php b/src/qtism/runtime/tests/AssessmentTestSession.php index a4910c56e..67ad3cb87 100644 --- a/src/qtism/runtime/tests/AssessmentTestSession.php +++ b/src/qtism/runtime/tests/AssessmentTestSession.php @@ -817,9 +817,11 @@ public function endTestSession() * * The time limits in force at the test level (assessmentTest, testPart, assessmentSection) is exceeded. * * The current item session is closed (no more attempts, time limits exceeded). * + * @param bool $allowLateSubmission If set to true, maximum time limits will not be taken into account. + * * @throws AssessmentTestSessionException */ - public function beginAttempt() + public function beginAttempt($allowLateSubmission = false) { if ($this->isRunning() === false) { $msg = 'Cannot begin an attempt for the current item while the state of the test session is INITIAL or CLOSED.'; @@ -827,7 +829,11 @@ public function beginAttempt() } // Are the time limits in force (at the test level) respected? - $this->checkTimeLimits(); + // -- Are time limits in force respected? + if ($allowLateSubmission === false) { + $this->checkTimeLimits(); + } + // Time limits are OK! Let's try to begin the attempt. $routeItem = $this->getCurrentRouteItem();