From 3ad4faf38a34c99fabb10766c8b09e31878dbaa7 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Thu, 1 Nov 2018 12:57:11 +0900 Subject: [PATCH] Limit game ranking lists to the top 10 --- pages/users/users.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pages/users/users.go b/pages/users/users.go index de108b67..f0cb197b 100644 --- a/pages/users/users.go +++ b/pages/users/users.go @@ -84,6 +84,10 @@ func Editors(ctx *aero.Context) string { return scoreA > scoreB }) + if len(users) > 10 { + users = users[:10] + } + return ctx.HTML(components.EditorRankingList(users, score, ctx.URI())) } @@ -124,8 +128,8 @@ func Osu(ctx *aero.Context) string { return users[i].Accounts.Osu.PP > users[j].Accounts.Osu.PP }) - if len(users) > 50 { - users = users[:50] + if len(users) > 10 { + users = users[:10] } return ctx.HTML(components.OsuRankingList(users, ctx.URI())) @@ -142,8 +146,8 @@ func Overwatch(ctx *aero.Context) string { return users[i].Accounts.Overwatch.SkillRating > users[j].Accounts.Overwatch.SkillRating }) - if len(users) > 50 { - users = users[:50] + if len(users) > 10 { + users = users[:10] } return ctx.HTML(components.OverwatchRankingList(users, ctx.URI())) @@ -160,8 +164,8 @@ func FFXIV(ctx *aero.Context) string { return users[i].Accounts.FinalFantasyXIV.ItemLevel > users[j].Accounts.FinalFantasyXIV.ItemLevel }) - if len(users) > 50 { - users = users[:50] + if len(users) > 10 { + users = users[:10] } return ctx.HTML(components.FinalFantasyXIVRankingList(users, ctx.URI()))