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 08924fe commit 9093a38
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 @@ -44,6 +44,8 @@ class assFileUpload extends assQuestion implements ilObjQuestionScoringAdjustabl

protected $allowedextensions;

private ?string $current_cmd;

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

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

/**
Expand Down Expand Up @@ -687,7 +691,10 @@ public function saveWorkingData($active_id, $pass = null, $authorized = true): b
$test_id = $this->lookupTestId($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 9093a38

Please sign in to comment.