master
Aevann1 2022-02-20 04:06:00 +02:00
parent c15905363b
commit 46a9091c17
1 changed files with 1 additions and 1 deletions

View File

@ -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).order_by(func.count(Badge.user_id).desc(), 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(func.count(Badge.user_id).desc(), 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(), User.id)
pos11 = g.db.query(User.id, sq.c.rank, sq.c.count).join(sq, User.id==sq.c.user_id).order_by(sq.c.count.desc(), User.id).filter(User.id == v.id).one_or_none()
print(pos11)