Skip to content

Commit

Permalink
TA 25418, float and round percentages for marks #4620 (+copyright)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbecker-databay committed Jun 13, 2022
1 parent 1173e3b commit da6818c
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions Modules/Test/classes/class.assMarkSchema.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
<?php
/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/

require_once './Modules/Test/classes/inc.AssessmentConstants.php';

Expand Down Expand Up @@ -270,8 +285,9 @@ public function getMatchingMark($percentage)
{
for ($i = count($this->mark_steps) - 1; $i >= 0; $i--) {
$curMinLevel = $this->mark_steps[$i]->getMinimumLevel();

if ($percentage > $curMinLevel || (string) $percentage == (string) $curMinLevel) { // >= does NOT work since PHP is a fucking female float pig !!!!
$reached = round($percentage, 2);
$level = round($curMinLevel, 2);
if ($reached >= $level) {
return $this->mark_steps[$i];
}
}
Expand Down

0 comments on commit da6818c

Please sign in to comment.