Skip to content

Commit

Permalink
Merge pull request #4620 from nhaagen/7/TA/25418
Browse files Browse the repository at this point in the history
TA 25418, float and round percentages for marks
  • Loading branch information
mbecker-databay authored Jun 13, 2022
2 parents e528011 + 2409c3a commit f97d9d4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Modules/Test/classes/class.assMarkSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function createSimpleSchema(
$txt_passed_official = "passed",
$percentage_passed = 50,
$passed_passed = 1
) {
) {
$this->flush();
$this->addMarkStep($txt_failed_short, $txt_failed_official, $percentage_failed, $failed_passed);
$this->addMarkStep($txt_passed_short, $txt_passed_official, $percentage_passed, $passed_passed);
Expand Down Expand Up @@ -296,8 +296,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 f97d9d4

Please sign in to comment.