From aa32a6c5e3d1c1b24a7e9e78306a45403a3c8a1a Mon Sep 17 00:00:00 2001 From: Rhythm <35167328+kRhythm@users.noreply.github.com> Date: Fri, 25 Feb 2022 17:19:12 +0530 Subject: [PATCH] fixed the time.now part --- handlers/services.go | 2 +- types/downtimes/database.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/handlers/services.go b/handlers/services.go index 94ea5b81..e553c06a 100644 --- a/handlers/services.go +++ b/handlers/services.go @@ -549,7 +549,7 @@ func apiAllServicesStatusHandler(w http.ResponseWriter, r *http.Request) { if t == "" { for _, v := range services.AllInOrder() { if v.Online == false { - downtime:= downtimes.FindDowntime3(v.Id) + downtime := downtimes.FindDowntime2(v.Id) m[v.Id] = downtime } } diff --git a/types/downtimes/database.go b/types/downtimes/database.go index 05e09a76..8b21c86d 100644 --- a/types/downtimes/database.go +++ b/types/downtimes/database.go @@ -67,9 +67,9 @@ func FindDowntime(timeVar time.Time) []Downtime { return downtime } -func FindDowntime3(service int64) Downtime { +func FindDowntime2(service int64) Downtime { var downtime Downtime - q := db.Where("service = ?",service) + q := db.Where("service = ?", service) q = q.Order("start desc").First(&downtime) return downtime }