improve sorting

This commit is contained in:
lemmi 2020-01-23 04:55:13 +01:00
parent 1dfefe75e7
commit 17bc5b2a45
1 changed files with 4 additions and 2 deletions

View File

@ -135,8 +135,10 @@ func (rs *routeStats) getLongest() []route {
sort.Slice(ret, func(i, j int) bool {
id := ret[i].Downtime(t)
jd := ret[j].Downtime(t)
if id == jd ||
(id < 0.5 && jd < 0.5) {
if ret[i].Counter != ret[j].Counter &&
(id == jd ||
(id < 0.5 && jd < 0.5)) {
return ret[i].Counter > ret[j].Counter
}
return id > jd