Skip to content

Commit

Permalink
chore: ignore branch rule if item/section from one test part pointing…
Browse files Browse the repository at this point in the history
… to another test part
  • Loading branch information
shpran committed Sep 22, 2023
1 parent fe05368 commit 9437903
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/qtism/runtime/tests/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -1117,10 +1117,11 @@ public function branch($identifier): void

if ($targetRouteItems[$occurence]->getTestPart() !== $this->current()->getTestPart()) {
// From IMS QTI:
// In case of an item or section, the target must refer to an item or section
// in the same testPart [...]
$msg = 'Branchings to items outside of the current testPart is forbidden by the QTI 2.1 specification.';
throw new OutOfBoundsException($msg);
// In the case of an item or section, the target must refer to an item or section in the same test-part
// that has not yet been presented.
$this->next();

return;
}

$this->setPosition($this->getRouteItemPosition($targetRouteItems[$occurence]));
Expand All @@ -1133,10 +1134,11 @@ public function branch($identifier): void
if (isset($assessmentSectionIdentifierMap[$id])) {
if ($assessmentSectionIdentifierMap[$id][0]->getTestPart() !== $this->current()->getTestPart()) {
// From IMS QTI:
// In case of an item or section, the target must refer to an item or section
// in the same testPart [...]
$msg = 'Branchings to assessmentSections outside of the current testPart is forbidden by the QTI 2.1 specification.';
throw new OutOfBoundsException($msg);
// In the case of an item or section, the target must refer to an item or section in the same test-part
// that has not yet been presented.
$this->next();

return;
}

// We branch to the first RouteItem belonging to the section.
Expand Down

0 comments on commit 9437903

Please sign in to comment.