Skip to content

Commit

Permalink
Merge pull request #327 from oat-sa/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
kilatib authored Aug 30, 2022
2 parents cdce917 + 0db264c commit ff1c20d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
17 changes: 8 additions & 9 deletions src/qtism/runtime/storage/binary/AbstractQtiBinaryStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
10 changes: 8 additions & 2 deletions src/qtism/runtime/tests/AssessmentTestSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -817,17 +817,23 @@ 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.';
throw new AssessmentTestSessionException($msg, AssessmentTestSessionException::STATE_VIOLATION);
}

// 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();
Expand Down

0 comments on commit ff1c20d

Please sign in to comment.