From 8544781ee174d8f07571ae5d306726a6582e3cdd Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 20 Feb 2022 03:54:56 +0200 Subject: [PATCH] bcv --- files/routes/users.py | 2 +- files/templates/leaderboard.html | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index 13e0983b2..624801d5c 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -356,7 +356,7 @@ def leaderboard(v): sq = g.db.query(User.id, func.rank().over(order_by=User.truecoins.desc()).label("rank")).subquery() pos10 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1] - sq = g.db.query(Badge.user_id, func.count(Badge.user_id).label("count"), func.rank().over(order_by=func.count(Badge.user_id).desc()).label("rank")).group_by(Badge.user_id).subquery() + sq = g.db.query(Badge.user_id, func.count(Badge.user_id).label("count"), func.rank().over(order_by=func.count(Badge.user_id).desc()).label("rank")).group_by(Badge.user_id).order_by(Badge.user_id).subquery() users11 = g.db.query(User, sq.c.count).join(sq, User.id==sq.c.user_id).order_by(sq.c.count.desc()) pos11 = g.db.query(User.id, sq.c.rank, sq.c.count).join(sq, User.id==sq.c.user_id).filter(User.id == v.id).one_or_none() if pos11: pos11 = (pos11[1],pos11[2]) diff --git a/files/templates/leaderboard.html b/files/templates/leaderboard.html index 9d0569631..8c79f677d 100644 --- a/files/templates/leaderboard.html +++ b/files/templates/leaderboard.html @@ -289,21 +289,14 @@ - {% set self=False %} {% for user in users11 %} - + {{loop.index}} @{{user[0].username}}'s profile picture{{user[0].username}} {{user[1]}} {% endfor %} - {% if not self and pos11[0] < 25 %} - - 26 - @{{v.username}}'s profile picture{{v.username}} - {{pos11[1]}} - - {% elif pos11 and (pos11[0] > 25 or not pos11[1]) %} + {% if pos11 and (pos11[0] > 25 or not pos11[1]) %} {{pos11[0]}} @{{v.username}}'s profile picture{{v.username}}