ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilTestPassFinishTasks Class Reference

Class ilTestPassFinishTasks. More...

+ Collaboration diagram for ilTestPassFinishTasks:

Public Member Functions

 __construct (private readonly ilTestSession $test_session, private readonly ilObjTest $obj_test, private readonly TestResultRepository $test_pass_result_repository)
 
 performFinishTasks (ilTestProcessLocker $process_locker, StatusOfAttempt $status_of_attempt)
 

Protected Member Functions

 updateLearningProgressAfterPassFinishedIsWritten ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTestPassFinishTasks::__construct ( private readonly ilTestSession  $test_session,
private readonly ilObjTest  $obj_test,
private readonly TestResultRepository  $test_pass_result_repository 
)

Definition at line 30 of file class.ilTestPassFinishTasks.php.

34  {
35  }

Member Function Documentation

◆ performFinishTasks()

ilTestPassFinishTasks::performFinishTasks ( ilTestProcessLocker  $process_locker,
StatusOfAttempt  $status_of_attempt 
)

Definition at line 37 of file class.ilTestPassFinishTasks.php.

References ilTestProcessLocker\executeTestFinishOperation(), null, and updateLearningProgressAfterPassFinishedIsWritten().

38  {
39  $process_locker->executeTestFinishOperation(function () use ($status_of_attempt) {
40  $pass = $this->test_session->getPass();
41 
42  if (!$this->test_session->isSubmitted()) {
43  $this->test_session->setSubmitted();
44  $this->test_session->setSubmittedTimestamp();
45  $this->test_session->saveToDb();
46  }
47 
48  $last_started_pass = (
49  $this->test_session->getLastStartedPass() === null ? -1 : $this->test_session->getLastStartedPass()
50  );
51 
52  $last_finished_pass = (
53  $this->test_session->getLastFinishedPass() === null ? -1 : $this->test_session->getLastFinishedPass()
54  );
55 
56  if ($last_started_pass > -1 && $last_finished_pass < $last_started_pass) {
57  $this->test_session->setLastFinishedPass($this->test_session->getPass());
58  $this->test_session->increaseTestPass(); // saves to db
59  }
60 
61  $this->test_pass_result_repository->finalizeTestPassResult(
62  $this->test_session->getActiveId(),
63  $pass,
64  $status_of_attempt
65  );
66  });
67 
68  $this->obj_test->updateTestResultCache($this->test_session->getActiveId(), null);
69 
71  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
executeTestFinishOperation(callable $operation)
+ Here is the call graph for this function:

◆ updateLearningProgressAfterPassFinishedIsWritten()

ilTestPassFinishTasks::updateLearningProgressAfterPassFinishedIsWritten ( )
protected

Definition at line 73 of file class.ilTestPassFinishTasks.php.

References ilObjTestAccess\_getParticipantId(), and ilLPStatusWrapper\_updateStatus().

Referenced by performFinishTasks().

74  {
76  $this->obj_test->getId(),
77  ilObjTestAccess::_getParticipantId($this->test_session->getActiveId())
78  );
79  }
static _getParticipantId($active_id)
Get user id for active id.
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: