Fix division by 0 issue in scoring
This commit is contained in:
parent
79fa53bc64
commit
a8ab2cef73
|
|
@ -48,7 +48,11 @@ class CalculateScoreSheetTotalDivideByWeightedPossible implements CalculateScore
|
||||||
$weightsTotal += $weight;
|
$weightsTotal += $weight;
|
||||||
$weightedMaxPossible += $maxPossible;
|
$weightedMaxPossible += $maxPossible;
|
||||||
}
|
}
|
||||||
|
if ($weightedMaxPossible > 0) {
|
||||||
$finalScore = ($scoreTotal / $weightedMaxPossible) * 100;
|
$finalScore = ($scoreTotal / $weightedMaxPossible) * 100;
|
||||||
|
} else {
|
||||||
|
$finalScore = 0;
|
||||||
|
}
|
||||||
// put $final score at the beginning of the $ScoreArray
|
// put $final score at the beginning of the $ScoreArray
|
||||||
array_unshift($scoreArray, $finalScore);
|
array_unshift($scoreArray, $finalScore);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue