remotes/1693045480750635534/spooky-22
Aevann1 2022-02-20 03:54:56 +02:00
parent 3a90fe2ea8
commit 8544781ee1
2 changed files with 3 additions and 10 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).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])

View File

@ -289,21 +289,14 @@
</tr>
</thead>
<tbody id="followers-table">
{% set self=False %}
{% for user in users11 %}
<tr {% if v.id == user[0].id %}class="self"{% set self=True %}{% endif %}>
<tr {% if v.id == user[0].id %}class="self"{% endif %}>
<td style="font-weight: bold">{{loop.index}}</td>
<td><a style="color:#{{user[0].namecolor}};font-weight:bold" href="/@{{user[0].username}}"><img alt="@{{user[0].username}}'s profile picture" loading="lazy" src="{{user[0].profile_url}}" class="pp20"><span {% if user[0].patron %}class="patron" style="background-color:#{{user[0].namecolor}}"{% endif %}>{{user[0].username}}</span></a></td>
<td style="font-weight: bold">{{user[1]}}</td>
</tr>
{% endfor %}
{% if not self and pos11[0] < 25 %}
<tr style="border-top:2px solid var(--primary)">
<td style="font-weight:bold">26</td>
<td><a style="color:#{{v.namecolor}};font-weight:bold" href="/@{{v.username}}"><img alt="@{{v.username}}'s profile picture" loading="lazy" src="{{v.profile_url}}" class="pp20"><span {% if v.patron %}class="patron" style="background-color:#{{v.namecolor}}"{% endif %}>{{v.username}}</span></a></td>
<td style="font-weight:bold">{{pos11[1]}}</td>
</tr>
{% elif pos11 and (pos11[0] > 25 or not pos11[1]) %}
{% if pos11 and (pos11[0] > 25 or not pos11[1]) %}
<tr style="border-top:2px solid var(--primary)">
<td style="font-weight:bold">{{pos11[0]}}</td>
<td><a style="color:#{{v.namecolor}};font-weight:bold" href="/@{{v.username}}"><img alt="@{{v.username}}'s profile picture" loading="lazy" src="{{v.profile_url}}" class="pp20"><span {% if v.patron %}class="patron" style="background-color:#{{v.namecolor}}"{% endif %}>{{v.username}}</span></a></td>