diff --git a/main.go b/main.go index 2ea3f74..895591c 100644 --- a/main.go +++ b/main.go @@ -47,7 +47,7 @@ func (r route) Downtime(now time.Time) float64 { } func (r route) Noise(now time.Time) bool { - return r.Counter <= uint(now.Sub(startTime).Hours()) && r.Downtime(now) < 0.1 + return r.Counter <= uint(now.Sub(startTime).Hours())+10 && r.Downtime(now) < 0.5 } func (r route) String() string { @@ -133,7 +133,13 @@ func (rs *routeStats) getLongest() []route { t := time.Now() sort.Slice(ret, func(i, j int) bool { - return ret[i].DurationUntil(t) > ret[j].DurationUntil(t) + id := ret[i].Downtime(t) + jd := ret[j].Downtime(t) + if id == jd || + (id < 0.5 && jd < 0.5) { + return ret[i].Counter > ret[j].Counter + } + return id > jd }) return ret