19declare(strict_types=0);
64 foreach ($status_info[
'results'] as $user_data) {
65 if (isset($user_data[$resultArrayStatus]) && $user_data[$resultArrayStatus]) {
66 $user_ids[] = (
int) $user_data[
'user_id'];
76 $participant_repository = TestDIC::dic()[
'participant.repository'];
79 $lp_status =
new self($a_obj_id);
82 foreach ($participant_repository->getParticipants($test_id) as $participant) {
83 $user_id = $participant->getUserId();
84 $status = $lp_status->determineStatus($a_obj_id,
$user_id);
89 'failed' => ($status === self::LP_STATUS_FAILED_NUM),
91 'not_attempted' => ($status === self::LP_STATUS_NOT_ATTEMPTED_NUM)
102 ?
object $a_obj =
null
105 $test_result_repository =
TestDIC::dic()[
'results.data.repository'];
110 $res = $this->db->query(
112 SELECT tst_active.active_id, tst_active.tries, count(tst_sequence.active_fi) " . $this->db->quoteIdentifier(
114 ) .
", tst_active.last_finished_pass,
116 (tst_test_settings.nr_of_tries - 1) = tst_active.last_finished_pass
121 LEFT JOIN tst_sequence
122 ON tst_sequence.active_fi = tst_active.active_id
124 ON tst_tests.test_id = tst_active.test_fi
125 LEFT JOIN tst_test_settings
126 ON tst_test_settings.id = tst_tests.settings_id
127 WHERE tst_active.user_fi = {$this->db->quote($a_usr_id, "integer
")}
128 AND tst_active.test_fi = {$this->db->quote(ilObjTestAccess::_getTestIDFromObjectID($a_obj_id), ilDBConstants::T_INTEGER)}
129 GROUP BY tst_active.active_id, tst_active.tries, is_last_pass
134 ($rec = $this->db->fetchAssoc(
$res))
135 && $rec[
'sequences'] > 0
137 $test_obj =
new ilObjTest($a_obj_id,
false);
138 $is_passed = $test_result_repository->isPassed($a_usr_id, $a_obj_id);
141 $is_finished =
false;
142 if ($rec[
'last_finished_pass'] !==
null && $rec[
'sequences'] - 1 === $rec[
'last_finished_pass']) {
152 if ($rec[
'last_finished_pass'] !==
null) {
158 if ($old_status !==
null
159 && $old_status !== self::LP_STATUS_NOT_ATTEMPTED_NUM
160 && $status === self::LP_STATUS_IN_PROGRESS_NUM) {
171 $status = self::LP_STATUS_IN_PROGRESS_NUM;
174 $status = $this->determineLpStatus($passed);
182 $status = self::LP_STATUS_FAILED_NUM;
185 $status = self::LP_STATUS_COMPLETED_NUM;
194 ?
object $a_obj =
null
196 $set = $this->db->query(
197 "SELECT tst_result_cache.*, tst_active.user_fi FROM " .
198 "tst_result_cache JOIN tst_active ON (tst_active.active_id = tst_result_cache.active_fi)" .
199 " JOIN tst_tests ON (tst_tests.test_id = tst_active.test_fi) " .
200 " WHERE tst_tests.obj_fi = " . $this->db->quote(
204 " AND tst_active.user_fi = " . $this->db->quote(
210 if ($rec = $this->db->fetchAssoc($set)) {
211 if ($rec[
"max_points"] > 0) {
214 100 / $rec[
"max_points"] * $rec[
"reached_points"]
static _getNotAttempted(int $a_obj_id)
static getUserIdsByResultArrayStatus( $objId, $resultArrayStatus)
determineStatusForScoreLastPassTests(bool $is_finished, bool $passed)
determinePercentage(int $a_obj_id, int $a_usr_id, ?object $a_obj=null)
static _getFailed(int $a_obj_id)
static _getInProgress(int $a_obj_id)
determineLpStatus(bool $passed)
static _getCompleted(int $a_obj_id)
static _getStatusInfo(int $a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
const LP_STATUS_COMPLETED_NUM
determineStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null)
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
static _lookupStatus(int $a_obj_id, int $a_user_id, bool $a_create=true)
Lookup status.
static _getStatusInfo(int $a_obj_id)
static _getTestIDFromObjectID(int $object_id)
Returns the ILIAS test id for a given object id.