Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ public function __construct(

public function performFinishTasks(ilTestProcessLocker $process_locker, StatusOfAttempt $status_of_attempt)
{
$process_locker->executeTestFinishOperation(function () use ($status_of_attempt) {
$should_send_notification = false;
$process_locker->executeTestFinishOperation(function () use ($status_of_attempt, &$should_send_notification) {
$pass = $this->test_session->getPass();

if (!$this->test_session->isSubmitted()) {
$this->test_session->setSubmitted();
$this->test_session->setSubmittedTimestamp();
$this->test_session->saveToDb();
$should_send_notification = true;
}

$last_started_pass = (
Expand All @@ -68,6 +70,7 @@ public function performFinishTasks(ilTestProcessLocker $process_locker, StatusOf
$this->obj_test->updateTestResultCache($this->test_session->getActiveId(), null);

$this->updateLearningProgressAfterPassFinishedIsWritten();
return $should_send_notification;
}

protected function updateLearningProgressAfterPassFinishedIsWritten()
Expand Down
12 changes: 7 additions & 5 deletions components/ILIAS/Test/classes/class.ilTestPlayerAbstractGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1051,17 +1051,19 @@ public function finishTestCmd()

protected function performTestPassFinishedTasks(StatusOfAttempt $status_of_attempt): void
{
(new ilTestPassFinishTasks(
$should_notify = (new ilTestPassFinishTasks(
$this->test_session,
$this->object,
$this->test_pass_result_repository
))->performFinishTasks($this->process_locker, $status_of_attempt);
$this->object->updateTestResultCache($this->test_session->getActiveId(), null);

$this->sendNewPassFinishedNotificationEmailIfActivated(
$this->test_session->getActiveId(),
$this->test_session->getPass()
);
if ($should_notify) {
$this->sendNewPassFinishedNotificationEmailIfActivated(
$this->test_session->getActiveId(),
$this->test_session->getPass()
);
}
}

protected function sendNewPassFinishedNotificationEmailIfActivated(int $active_id, int $pass)
Expand Down