ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ParticipantResult.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
29{
30 public function __construct(
31 private int $active_id,
32 private int $attempt,
33 private float $max_points,
34 private float $reached_points,
35 private Mark $mark,
36 private int $timestamp,
37 private bool $passed_once,
38 ) {
39 }
40
41 public function withPassedOnce(bool $passed_once): self
42 {
43 $clone = clone $this;
44 $clone->passed_once = $passed_once;
45 return $clone;
46 }
47
48 public function getPercentage(): float
49 {
50 return $this->max_points > 0 ? $this->reached_points / $this->max_points * 100 : 0.0;
51 }
52
53 public function getActiveId(): int
54 {
55 return $this->active_id;
56 }
57
58 public function getAttempt(): int
59 {
60 return $this->attempt;
61 }
62
63 public function getMaxPoints(): float
64 {
65 return $this->max_points;
66 }
67
68 public function getReachedPoints(): float
69 {
70 return $this->reached_points;
71 }
72
73 public function getMark(): Mark
74 {
75 return $this->mark;
76 }
77
78 public function getMarkOfficial(): string
79 {
80 return $this->mark->getOfficialName();
81 }
82
83 public function getMarkShort(): string
84 {
85 return $this->mark->getShortName();
86 }
87
88 public function isPassed(): bool
89 {
90 return $this->mark->getPassed();
91 }
92
93 public function isFailed(): bool
94 {
95 return !$this->mark->getPassed();
96 }
97
98 public function getTimestamp(): int
99 {
100 return $this->timestamp;
101 }
102
103 public function isPassedOnce(): bool
104 {
105 return $this->passed_once;
106 }
107}
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:70
Class ParticipantResult is a model representation of an entry in the test_result_cache table.
__construct(private int $active_id, private int $attempt, private float $max_points, private float $reached_points, private Mark $mark, private int $timestamp, private bool $passed_once,)
A class defining marks for assessment test objects.
Definition: Mark.php:36