Skip to content

Commit

Permalink
Merge pull request #4027 from nhaagen/7/TA/21097
Browse files Browse the repository at this point in the history
TA: 21997, do not (auto)save over max passes.
  • Loading branch information
mbecker-databay authored Feb 23, 2022
2 parents 2a8bee5 + 693e973 commit f33952f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Modules/Test/classes/class.ilTestOutputGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,16 @@ public function saveQuestionSolution($authorized = true, $force = false)
return false;
}
}

/*
#21097 - exceed maximum passes
this is a battle of conditions; e.g. ilTestPlayerAbstractGUI::autosaveOnTimeLimitCmd forces saving of results.
However, if an admin has finished the pass in the meantime, a new pass should not be created.
*/
if ($force && $this->isNrOfTriesReached()) {
$force = false;
}

// save question solution
if ($this->canSaveResult() || $force) {
// but only if the ending time is not reached
Expand Down Expand Up @@ -655,7 +665,7 @@ public function saveQuestionSolution($authorized = true, $force = false)
}
}

if ($this->saveResult == false || (!$questionOBJ->validateSolutionSubmit() && $questionOBJ->savePartial()) ) {
if ($this->saveResult == false || (!$questionOBJ->validateSolutionSubmit() && $questionOBJ->savePartial())) {
$this->ctrl->setParameter($this, "save_error", "1");
$_SESSION["previouspost"] = $_POST;
}
Expand All @@ -678,7 +688,7 @@ protected function showInstantResponseCmd()
}
$this->testSequence->setQuestionChecked($questionId);
$this->testSequence->saveToDb();
} else if ($this->object->isForceInstantFeedbackEnabled()) {
} elseif ($this->object->isForceInstantFeedbackEnabled()) {
$this->testSequence->setQuestionChecked($questionId);
$this->testSequence->saveToDb();
}
Expand Down

0 comments on commit f33952f

Please sign in to comment.