From 56f190cb31330517eba78268b619efd7b763a759 Mon Sep 17 00:00:00 2001 From: "Dipesh K.C" Date: Tue, 8 Mar 2022 09:20:21 +0545 Subject: [PATCH] fix: OnlineSince Calculation --- types/services/methods.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/types/services/methods.go b/types/services/methods.go index 18a71e19..e6d1601e 100644 --- a/types/services/methods.go +++ b/types/services/methods.go @@ -287,12 +287,8 @@ func (s *Service) OnlineSince(ago time.Time) float32 { return s.Online24Hours } - avg := (float64(failsList) / float64(hitsList)) * 100 - avg = 100 - avg - if avg < 0 { - avg = 0 - } - amount, _ := strconv.ParseFloat(fmt.Sprintf("%0.2f", avg), 10) + amount := (hitsList / totalList) * 100 + s.Online24Hours = float32(amount) return s.Online24Hours }