mirror of https://github.com/statping/statping
changed studd
parent
bfca2113cc
commit
a21b72b154
|
@ -548,14 +548,14 @@ func apiAllServicesStatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
m := make(map[int64]downtimes.Downtime)
|
m := make(map[int64]downtimes.Downtime)
|
||||||
if t == "" {
|
if t == "" {
|
||||||
dtime := downtimes.FindDowntime2()
|
dtime := downtimes.FindDowntime2()
|
||||||
log.Println(len(dtime))
|
log.Println("FindDowntime2 results")
|
||||||
log.Println(dtime)
|
log.Println(dtime)
|
||||||
for i := 0; i < len(dtime); i+=1 {
|
/*for i := 0; i < len(dtime); i+=1 {
|
||||||
downtimeVar := dtime[i]
|
downtimeVar := dtime[i]
|
||||||
/*serviceVar, _ := services.Find(downtimeVar.ServiceId)
|
serviceVar, _ := services.Find(downtimeVar.ServiceId)
|
||||||
*/
|
|
||||||
m[downtimeVar.ServiceId] = downtimeVar
|
m[downtimeVar.ServiceId] = downtimeVar
|
||||||
}
|
}*/
|
||||||
} else {
|
} else {
|
||||||
dtime := findAllDowntimes(t)
|
dtime := findAllDowntimes(t)
|
||||||
for i := 0; i < len(dtime); i += 1 {
|
for i := 0; i < len(dtime); i += 1 {
|
||||||
|
|
|
@ -67,8 +67,8 @@ func FindDowntime(timeVar time.Time) []Downtime {
|
||||||
return downtime
|
return downtime
|
||||||
}
|
}
|
||||||
|
|
||||||
func FindDowntime2() []Downtime {
|
func FindDowntime2() interface{} {
|
||||||
var downtime []Downtime
|
var downtime interface{}
|
||||||
db.Raw("SELECT DISTINCT ON (downtimes.service) downtimes.* FROM downtimes ORDER BY service ASC, start DESC;").Scan(&downtime)
|
db.Raw("SELECT DISTINCT ON (downtimes.service) downtimes.* FROM downtimes ORDER BY service ASC, start DESC;").Scan(&downtime)
|
||||||
//db.Select("downtimes.*").Joins("left join downtimes as d2 on d2.service = downtimes.service AND downtimes.start < d2.start").Where("d2.end = ?",nil).Find(&downtime)
|
//db.Select("downtimes.*").Joins("left join downtimes as d2 on d2.service = downtimes.service AND downtimes.start < d2.start").Where("d2.end = ?",nil).Find(&downtime)
|
||||||
return downtime
|
return downtime
|
||||||
|
|
Loading…
Reference in New Issue