mirror of
https://github.com/FairwindsOps/polaris.git
synced 2026-05-24 18:13:08 +00:00
Directly return 0 for divide by 0
This commit is contained in:
@@ -18,7 +18,7 @@ type CountSummaryByCategory map[string]CountSummary
|
||||
func (cs CountSummary) GetScore() uint {
|
||||
total := (cs.Successes * 2) + cs.Warnings + (cs.Errors * 2)
|
||||
if total == 0 {
|
||||
total = 1 // Prevent divide by 0.
|
||||
return 0 // Prevent divide by 0.
|
||||
}
|
||||
return uint((float64(cs.Successes*2) / float64(total)) * 100)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user