1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

Sort summary items in descending order.

This commit is contained in:
Ferdinand Mütsch 2019-07-07 10:37:17 +02:00
parent e18a873428
commit 8a3ce596f5

View File

@ -2,6 +2,7 @@ package services
import (
"math"
"sort"
"time"
"github.com/jinzhu/gorm"
@ -110,5 +111,9 @@ func (srv *SummaryService) aggregateBy(heartbeats []*models.Heartbeat, summaryTy
})
}
sort.Slice(items, func(i, j int) bool {
return items[i].Total > items[j].Total
})
c <- models.SummaryItemContainer{Type: summaryType, Items: items}
}