Skip to content

Commit 5432fa5

Browse files
matheuszychthojou
authored andcommitted
Fixes redirect to blank page when resuming a test and error that a started test pass does not contain any questions
1 parent 5d498eb commit 5432fa5

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

components/ILIAS/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* This file is part of ILIAS, a powerful learning management system
45
* published by ILIAS open source e-Learning e.V.
@@ -155,10 +156,12 @@ public function prepareTestPass(ilTestSession $a_test_session, ilTestSequence $a
155156

156157
$this->updateQuestions($a_test_session, $a_test_sequence);
157158

158-
if ($this->getSettings()->getPassedObjectiveMode() == ilLOSettings::MARK_PASSED_OBJECTIVE_QST) {
159-
$this->setQuestionsOptional($a_test_sequence);
160-
} elseif ($this->getSettings()->getPassedObjectiveMode() == ilLOSettings::HIDE_PASSED_OBJECTIVE_QST) {
161-
$this->hideQuestions($a_test_sequence);
159+
if ($this->getSettings()->getQualifiedTest() === $a_test_session->getRefId()) {
160+
if ($this->getSettings()->getPassedObjectiveMode() == ilLOSettings::MARK_PASSED_OBJECTIVE_QST) {
161+
$this->setQuestionsOptional($a_test_sequence);
162+
} elseif ($this->getSettings()->getPassedObjectiveMode() == ilLOSettings::HIDE_PASSED_OBJECTIVE_QST) {
163+
$this->hideQuestions($a_test_sequence);
164+
}
162165
}
163166

164167
$this->storeTestRun();

components/ILIAS/Test/src/Presentation/class.TestScreenGUI.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,11 @@ private function getLauncher(): Launcher
291291

292292
private function getResumeLauncherLink(): Link
293293
{
294-
$url = $this->ctrl->getLinkTarget(
295-
(new \ilTestPlayerFactory($this->object))->getPlayerGUI(),
294+
$class = $this->object->isFixedTest()
295+
? \ilTestPlayerFixedQuestionSetGUI::class
296+
: \ilTestPlayerRandomQuestionSetGUI::class;
297+
$url = $this->ctrl->getLinkTargetByClass(
298+
[\ilRepositoryGUI::class, \ilObjTestGUI::class, $class],
296299
\ilTestPlayerCommands::RESUME_PLAYER
297300
);
298301
return $this->data_factory->link($this->lng->txt('tst_resume_test'), $this->data_factory->uri(ILIAS_HTTP_PATH . '/' . $url));
@@ -391,8 +394,11 @@ private function getModalLauncherMessageBox(): ?MessageBox
391394

392395
private function getStartLauncherLink(): Link
393396
{
394-
$url = $this->ctrl->getLinkTarget(
395-
(new \ilTestPlayerFactory($this->object))->getPlayerGUI(),
397+
$class = $this->object->isFixedTest()
398+
? \ilTestPlayerFixedQuestionSetGUI::class
399+
: \ilTestPlayerRandomQuestionSetGUI::class;
400+
$url = $this->ctrl->getLinkTargetByClass(
401+
[\ilRepositoryGUI::class, \ilObjTestGUI::class, $class],
396402
\ilTestPlayerCommands::INIT_TEST
397403
);
398404
return $this->data_factory->link($this->lng->txt('tst_exam_start'), $this->data_factory->uri(ILIAS_HTTP_PATH . '/' . $url));

0 commit comments

Comments
 (0)