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 }