19declare(strict_types=1);
32 private readonly ?
int $active_id =
null,
33 private readonly ?
int $test_id =
null,
34 private readonly ?
string $anonymous_id =
null,
35 private readonly
string $firstname =
'',
36 private readonly
string $lastname =
'',
37 private readonly
string $login =
'',
38 private readonly
string $matriculation =
'',
39 private int $extra_time = 0,
40 private readonly
int $attempts = 0,
41 private ?
string $client_ip_from =
null,
42 private ?
string $client_ip_to =
null,
43 private readonly ?
int $invitation_date =
null,
44 private readonly ?
bool $submitted =
null,
45 private readonly ?
int $last_started_attempt =
null,
46 private readonly ?
int $last_finished_attempt =
null,
47 private readonly
bool $unfinished_attempts =
false,
48 private readonly ?\DateTimeImmutable $first_access =
null,
49 private readonly ?\DateTimeImmutable $last_access =
null,
50 private readonly
bool $scoring_finalized =
false
61 return $this->active_id;
66 return $this->test_id;
71 return $this->anonymous_id;
76 return $this->firstname;
81 return $this->lastname;
91 return $this->matriculation;
96 return $this->extra_time;
101 $clone = clone $this;
102 $clone->extra_time += $extra_time;
108 return $this->attempts;
113 return $this->client_ip_from;
121 $clone = clone $this;
122 $clone->client_ip_from = $ip;
128 return $this->client_ip_to;
136 $clone = clone $this;
137 $clone->client_ip_to = $ip;
143 return $this->invitation_date > 0;
148 return $this->submitted;
153 if (!$processing_time) {
157 return $processing_time + $this->extra_time * 60;
162 return $this->last_started_attempt;
167 return $this->last_finished_attempt;
172 return $this->unfinished_attempts;
177 return $this->first_access;
182 return $this->last_access;
187 return $this->attempt_overview?->hasAnsweredQuestions() ??
false;
191 int $processing_time,
192 bool $reset_time_on_new_attempt
197 if ($reset_time_on_new_attempt) {
198 $start = $this->running_attempt_start?->getTimestamp();
201 if ($start ===
null) {
205 $remaining += $start;
206 if ($this->submitted) {
207 $remaining -= $this->
getLastAccess()?->getTimestamp() ?? time();
209 $remaining -= time();
212 return max(0, $remaining);
217 return $this->attempt_overview;
222 $clone = clone $this;
223 $clone->attempt_overview = $attempt_overview;
229 $clone = clone $this;
230 $clone->running_attempt_start = $start_date;
236 return $this->scoring_finalized;
hasAnsweredQuestionsForScoredAttempt()
getTotalDuration(?int $processing_time)
withClientIpFrom(?string $ip)
__construct(private readonly int $user_id, private readonly ?int $active_id=null, private readonly ?int $test_id=null, private readonly ?string $anonymous_id=null, private readonly string $firstname='', private readonly string $lastname='', private readonly string $login='', private readonly string $matriculation='', private int $extra_time=0, private readonly int $attempts=0, private ?string $client_ip_from=null, private ?string $client_ip_to=null, private readonly ?int $invitation_date=null, private readonly ?bool $submitted=null, private readonly ?int $last_started_attempt=null, private readonly ?int $last_finished_attempt=null, private readonly bool $unfinished_attempts=false, private readonly ?\DateTimeImmutable $first_access=null, private readonly ?\DateTimeImmutable $last_access=null, private readonly bool $scoring_finalized=false)
withRunningAttemptStart(\DateTimeImmutable $start_date)
withAttemptOverviewInformation(?AttemptOverview $attempt_overview)
AttemptOverview $attempt_overview
withAddedExtraTime(int $extra_time)
getRemainingDuration(int $processing_time, bool $reset_time_on_new_attempt)
withClientIpTo(?string $ip)
DateTimeImmutable $running_attempt_start
getAttemptOverviewInformation()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...