Skip to content

Commit

Permalink
Test: Fix Navigation on Empty FileQuestion
Browse files Browse the repository at this point in the history
  • Loading branch information
kergomard committed Dec 8, 2024
1 parent c632f0a commit 82e5bd8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Modules/TestQuestionPool/classes/class.assFileUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class assFileUpload extends assQuestion implements ilObjQuestionScoringAdjustabl

protected string $allowedextensions = '';

private ?string $current_cmd;

/** @var boolean Indicates whether completion by submission is enabled or not */
protected $completion_by_submission = false;

Expand All @@ -72,10 +74,12 @@ public function __construct(
$question = ''
) {
parent::__construct($title, $comment, $author, $owner, $question);
/** @var ILIAS\DI\Container $DIC */
global $DIC;
$this->irss = $DIC->resourceStorage();
$this->file_delivery = $DIC->fileDelivery();
$this->file_upload = $DIC->upload();
$this->current_cmd = $DIC['ilCtrl']->getCmd();
}

/**
Expand Down Expand Up @@ -511,7 +515,7 @@ public function getUploadedFilesForWeb($active_id, $pass): array

if ($data['value2'] === 'rid') {
$rid = $this->irss->manage()->find($data['value1']);
if($rid === null) {
if ($rid === null) {
continue;
}
$revision = $this->irss->manage()->getCurrentRevision($rid);
Expand Down Expand Up @@ -679,7 +683,10 @@ public function saveWorkingData($active_id, $pass = null, $authorized = true): b
$test_id = $this->testParticipantInfo->lookupTestIdByActiveId($active_id);

try {
$upload_handling_required = $this->isFileUploadAvailable() && $this->checkUpload();
$upload_handling_required = $this->current_cmd !== 'submitSolution'
&& !$this->isFileDeletionAction()
&& $this->isFileUploadAvailable()
&& $this->checkUpload();
} catch (IllegalStateException $e) {
$this->tpl->setOnScreenMessage('failure', $e->getMessage(), true);
return false;
Expand Down

0 comments on commit 82e5bd8

Please sign in to comment.