fix(api): ensure stable sort order when group is repeated

This commit is contained in:
Łukasz Mierzwa
2020-06-23 16:57:32 +01:00
committed by Łukasz Mierzwa
parent d913232869
commit f2cc599a40

View File

@@ -157,6 +157,9 @@ func getGroupLabel(group *models.APIAlertGroup, label string) string {
}
func sortByStartsAt(i, j int, groups []models.APIAlertGroup, sortReverse bool) bool {
if groups[i].LatestStartsAt == groups[j].LatestStartsAt {
return groups[i].ID > groups[j].ID
}
if sortReverse {
return groups[i].LatestStartsAt.After(groups[j].LatestStartsAt)
}