19declare(strict_types=1);
26 $repo =
$dic[
'repo.assignment'];
31 $assignments = $repo->getAllForNodeIsContained((
int)
$obj_id, $usr_id);
34 $assignments = array_filter($assignments, fn($ass) => !$ass->isRestarted());
44 if($assignments === []) {
47 $now =
new DateTimeImmutable();
50 foreach ($assignments as $ass) {
51 $pgs = $ass->getProgressForNode($prg_obj_id);
52 $pgss[$ass->getId()] = $pgs;
53 $sorting[] = $ass->getId();
58 $sorting = array_reverse($sorting);
59 $pgs = $pgss[reset($sorting)];
61 if (!$pgs || !$pgs->isRelevant()) {
65 if ($pgs->hasValidQualification($now)) {
69 if ($pgs->isSuccessful() || $pgs->isFailed()) {
89 foreach ($assignments as $ass) {
90 $usr_id = $ass->getUserId();
91 if (!array_key_exists($usr_id, $user_centric)) {
92 $user_centric[$usr_id] = [];
94 $user_centric[$usr_id][] = $ass;
96 foreach ($user_centric as $usr_id => $assignments) {
98 $matrix[$status][] = $usr_id;
106 throw new \Exception(
'called');
107 return count(self::_getInProgress($a_obj_id));
119 return count(self::_getCompleted($a_obj_id));
static getStatusForAssignments(array $assignments, int $prg_obj_id)
determine a status based on a single users collection of assignments.
determineStatus($a_obj_id, $a_user_id, $a_obj=null)
static _getFailed($a_obj_id)
static _getCountCompleted($a_obj_id)
static getAssignmentsLPMatrix(array $assignments, int $prg_obj_id)
static _getInProgress($a_obj_id)
static _getCompleted($a_obj_id)
static _getCountInProgress($a_obj_id)
static getAssignments(int $obj_id, ?int $usr_id=null)
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_FAILED_NUM