From 534286132dbb4d82e01bf440e188aa4993a66d96 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 17 Nov 2017 15:16:47 +0100 Subject: [PATCH] Sort by followers and make it deterministic --- pages/users/users.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pages/users/users.go b/pages/users/users.go index cdc3d706..d6a3df83 100644 --- a/pages/users/users.go +++ b/pages/users/users.go @@ -15,7 +15,14 @@ func Active(ctx *aero.Context) string { }) sort.Slice(users, func(i, j int) bool { - return len(users[i].AnimeList().Watching().Items) > len(users[j].AnimeList().Watching().Items) + followersA := users[i].FollowersCount() + followersB := users[j].FollowersCount() + + if followersA == followersB { + return users[i].Nick > users[j].Nick + } + + return followersA > followersB }) // arn.SortUsersLastSeen(users)