Merge pull request #1 from dipeshhkc/fix-online-since-calc-patch-1

fix: OnlineSince Calculation
pull/1080/head
Dipesh K.C 2022-03-08 09:25:48 +05:45 committed by GitHub
commit 9c07ec46c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

@ -287,12 +287,8 @@ func (s *Service) OnlineSince(ago time.Time) float32 {
return s.Online24Hours return s.Online24Hours
} }
avg := (float64(failsList) / float64(hitsList)) * 100 amount := (hitsList / totalList) * 100
avg = 100 - avg
if avg < 0 {
avg = 0
}
amount, _ := strconv.ParseFloat(fmt.Sprintf("%0.2f", avg), 10)
s.Online24Hours = float32(amount) s.Online24Hours = float32(amount)
return s.Online24Hours return s.Online24Hours
} }