diff options
| author | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
|---|---|---|
| committer | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
| commit | 4459dd7917f4d1c34f40bb68f0e991e9c3d53e4c (patch) | |
| tree | 5c07151ae61276d334e88f6309c30d439a85c12e /lib/models/Grading/Instance.php | |
| parent | da0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff) | |
| parent | 97a188592c679890a25c37ab78463add76a52ff7 (diff) | |
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'lib/models/Grading/Instance.php')
| -rw-r--r-- | lib/models/Grading/Instance.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/models/Grading/Instance.php b/lib/models/Grading/Instance.php index 14ab25a..7f362d3 100644 --- a/lib/models/Grading/Instance.php +++ b/lib/models/Grading/Instance.php @@ -66,4 +66,22 @@ class Instance extends \SimpleORMap return self::findBySql('definition_id IN (?) AND user_id = ?', [$definitionIds, $user->id]); } + + /** + * setter for the rawgrade column. The database type is decimal(6,5) UNSIGNED, therefore + * the setter mimics the database behaviour to get valid results from ::isFieldDirty() + * + * @param mixed $grade + * @return string + */ + public function setRawgrade($grade = 0): string + { + if ($grade < 0) { + $grade = 0; + } + if ($grade >= 10) { + $grade = 9.99999; + } + return $this->content['rawgrade'] = number_format($grade, 5, '.', ''); + } } |
