19 declare(strict_types=1);
62 return is_array($this->passes);
74 SELECT DISTINCT tst_pass_result.* FROM tst_pass_result 75 LEFT JOIN tst_test_result 76 ON tst_pass_result.pass = tst_test_result.pass 77 AND tst_pass_result.active_fi = tst_test_result.active_fi 78 WHERE tst_pass_result.active_fi = %s 79 ORDER BY tst_pass_result.pass 82 $res = $this->db->queryF(
90 while ($row = $this->db->fetchAssoc(
$res)) {
91 $this->passes[$row[
'pass']] = $row;
103 $query =
'SELECT last_finished_pass FROM tst_active WHERE active_id = %s';
105 $res = $this->db->queryF(
111 while ($row = $this->db->fetchAssoc(
$res)) {
157 $reportable_passes = [];
159 foreach ($existing_passes as $pass) {
161 $reportable_passes[] = $pass;
165 return $reportable_passes;
172 foreach ($existing_passes as $pass) {
174 $closed_passes[] = $pass;
178 return $closed_passes;
185 foreach ($existing_passes as $pass) {
186 if ($last_pass === null || $pass > $last_pass) {
196 switch ($this->test_obj->getScoreReporting()) {
204 if ($pass < $last_pass) {
224 throw new ilTestException(
'invalid object state: last finished pass was not set!');
245 $reporting_date = $this->test_obj->getScoreSettings()->getResultSummarySettings()->getReportingDate();
251 if (!$this->test_obj->getEnableProcessingTime()) {
255 $startingTime = $this->test_obj->getStartingTimeOfUser($this->
getActiveId(), $pass);
257 if ($startingTime ===
false) {
261 return $this->test_obj->isMaxProcessingTimeReached($startingTime, $this->
getActiveId());
267 if ($last_finished_pass === null || $last_finished_pass === -1) {
272 if (!isset($passes[$last_finished_pass])) {
280 if (!isset($this->test_passed_once_cache[$active_id])) {
281 $this->test_passed_once_cache[
$active_id] =
false;
283 $res = $this->db->queryF(
284 'SELECT passed_once FROM tst_result_cache WHERE active_fi = %s',
289 while ($row = $this->db->fetchAssoc(
$res)) {
290 $this->test_passed_once_cache[
$active_id] = (bool) $row[
'passed_once'];
294 return $this->test_passed_once_cache[
$active_id];
fetchClosedPasses(array $existing_passes)
hasTestPassedOnce(int $active_id)
const SCORE_REPORTING_AFTER_PASSED
__construct(private ilDBInterface $db, private ilObjTest $test_obj)
checkLastFinishedPassInitialised()
Base Exception for all Exceptions relating to Modules/Test.
fetchLastPass(array $existing_passes)
const SCORE_REPORTING_FINISHED
const SCORE_REPORTING_DATE
setActiveId(?int $active_id)
getLastFinishedPassTimestamp()
setLastFinishedPass(?int $last_finished_pass)
isProcessingTimeReached(int $pass)
const SCORE_REPORTING_IMMIDIATLY
fetchReportablePasses(array $existing_passes)
isReportablePass(int $last_pass, int $pass)
array $test_passed_once_cache