Fix division by 0 issue in scoring

This commit is contained in:
Matt Young 2025-01-20 11:15:32 -06:00
parent 79fa53bc64
commit a8ab2cef73
1 changed files with 5 additions and 1 deletions

View File

@ -48,7 +48,11 @@ class CalculateScoreSheetTotalDivideByWeightedPossible implements CalculateScore
$weightsTotal += $weight;
$weightedMaxPossible += $maxPossible;
}
if ($weightedMaxPossible > 0) {
$finalScore = ($scoreTotal / $weightedMaxPossible) * 100;
} else {
$finalScore = 0;
}
// put $final score at the beginning of the $ScoreArray
array_unshift($scoreArray, $finalScore);