From b64811a991fa529b604a1a87c82cf5fa95a96771 Mon Sep 17 00:00:00 2001 From: Rhythm <35167328+kRhythm@users.noreply.github.com> Date: Thu, 24 Feb 2022 17:31:52 +0530 Subject: [PATCH] adjusted the condition --- handlers/services.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/services.go b/handlers/services.go index 525a380c..4aa41043 100644 --- a/handlers/services.go +++ b/handlers/services.go @@ -547,14 +547,14 @@ func apiAllServicesStatusHandler(w http.ResponseWriter, r *http.Request) { var srvs []services.ServiceWithDowntime m := make(map[int64]downtimes.Downtime) if t == "" { - dtime:=downtimes.FindDowntime2() timeNow := time.Now() + dtime:=downtimes.FindDowntime2() for i := 0; i < len(dtime); i++ { downtimeVar := dtime[i] serviceVar,_ := services.Find(downtimeVar.ServiceId) checkInterval := time.Duration(serviceVar.Interval) timeInstance := timeNow.Add(-time.Second * checkInterval) - if(timeInstance.After(*(downtimeVar.Start)) || timeInstance.Equal(*(downtimeVar.Start)) ) && (downtimeVar.End == nil || (timeInstance.Before(*(downtimeVar.End)) || timeInstance.Equal(*(downtimeVar.End))) ){ + if downtimeVar.End == nil || timeInstance.Before(*(downtimeVar.End)) || timeInstance.Equal(*(downtimeVar.End)) { m[downtimeVar.ServiceId] = downtimeVar } }