forked from MarseyWorld/MarseyWorld
post
parent
c067d2b822
commit
d11acee284
|
@ -301,18 +301,31 @@ def transfer_bux(v, username):
|
|||
@auth_required
|
||||
def leaderboard(v):
|
||||
users = g.db.query(User)
|
||||
|
||||
users1 = users.order_by(User.coins.desc()).all()
|
||||
pos = users1.index(v)
|
||||
pos1 = users1.index(v)
|
||||
users1 = users1[:25]
|
||||
users2 = users.order_by(User.stored_subscriber_count.desc()).limit(25).all()
|
||||
users3 = users.order_by(User.post_count.desc()).limit(25).all()
|
||||
users4 = users.order_by(User.comment_count.desc()).limit(25).all()
|
||||
|
||||
users2 = users.order_by(User.stored_subscriber_count.desc()).all()
|
||||
pos2 = users2.index(v)
|
||||
users2 = users2[:25]
|
||||
|
||||
users3 = users.order_by(User.post_count.desc()).all()
|
||||
pos3 = users3.index(v)
|
||||
users3 = users3[:25]
|
||||
|
||||
users4 = users.order_by(User.comment_count.desc()).all()
|
||||
pos4 = users4.index(v)
|
||||
users4 = users4[:25]
|
||||
|
||||
users5 = users.order_by(User.received_award_count.desc()).limit(25).all()
|
||||
|
||||
if request.host == 'pcmemes.net': users6 = users.order_by(User.basedcount.desc()).limit(10).all()
|
||||
else: users6 = None
|
||||
|
||||
users7 = users.order_by(User.coins_spent.desc()).limit(25).all()
|
||||
users7 = users.order_by(User.coins_spent.desc()).all()
|
||||
pos7 = users7.index(v)
|
||||
users7 = users7[:25]
|
||||
|
||||
votes1 = g.db.query(Submission.author_id, func.count(Submission.author_id)).join(Vote, Vote.submission_id==Submission.id).filter(Vote.vote_type==-1).group_by(Submission.author_id).order_by(func.count(Submission.author_id).desc()).all()
|
||||
votes2 = g.db.query(Comment.author_id, func.count(Comment.author_id)).join(CommentVote, CommentVote.comment_id==Comment.id).filter(CommentVote.vote_type==-1).group_by(Comment.author_id).order_by(func.count(Comment.author_id).desc()).all()
|
||||
|
@ -322,8 +335,9 @@ def leaderboard(v):
|
|||
for user in users8: users9.append((user, votes3[user.id]))
|
||||
users9 = sorted(users9, key=lambda x: x[1], reverse=True)[:25]
|
||||
|
||||
users10 = g.db.query(User).order_by(User.truecoins.desc()).limit(25).all()
|
||||
|
||||
users10 = g.db.query(User).order_by(User.truecoins.desc()).all()
|
||||
pos10 = users10.index(v)
|
||||
users10 = users10[:25]
|
||||
|
||||
badges = g.db.query(Badge.user_id, func.count(Badge.user_id)).group_by(Badge.user_id).order_by(func.count(Badge.user_id).desc()).all()
|
||||
badges = dict(badges)
|
||||
|
@ -335,7 +349,7 @@ def leaderboard(v):
|
|||
if request.host == 'rdrama.net': users13 = topmakers
|
||||
else: users13 = None
|
||||
|
||||
return render_template("leaderboard.html", v=v, users1=users1, pos=pos, users2=users2, users3=users3, users4=users4, users5=users5, users6=users6, users7=users7, users9=users9, users10=users10, users12=users12, users13=users13, users15=users15)
|
||||
return render_template("leaderboard.html", v=v, users1=users1, pos1=pos1, users2=users2, pos2=pos2, users3=users3, pos3=pos3, users4=users4, pos4=pos4, users5=users5, users6=users6, users7=users7, pos7=pos7, users9=users9, users10=users10, pos10=pos10, users12=users12, users13=users13, users15=users15)
|
||||
|
||||
|
||||
@app.get("/@<username>/css")
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
<td style="font-weight:bold; text-align:right;">{{user.coins}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% if pos > 25 %}
|
||||
<tr style="border-top:2px solid var(--primary)">
|
||||
<td style="font-weight:bold;">{{pos}}</td>
|
||||
{% if pos1 > 25 %}
|
||||
<tr style="border-top:1px solid var(--primary)">
|
||||
<td style="font-weight:bold;">{{pos1}}</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; text-align:right;">{{v.coins}}</td>
|
||||
</tr>
|
||||
|
@ -56,6 +56,13 @@
|
|||
<td style="font-weight:bold; text-align:right;">{{user.coins_spent}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% if pos7 > 25 %}
|
||||
<tr style="border-top:1px solid var(--primary)">
|
||||
<td style="font-weight:bold;">{{pos7}}</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; text-align:right;">{{v.coins_spent}}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
|
||||
|
||||
|
@ -84,6 +91,13 @@
|
|||
<td style="font-weight:bold; text-align:right;">{{user.truecoins}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% if pos10 > 25 %}
|
||||
<tr style="border-top:1px solid var(--primary)">
|
||||
<td style="font-weight:bold;">{{pos10}}</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; text-align:right;">{{v.truecoins}}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -111,6 +125,13 @@
|
|||
<td style="font-weight:bold; text-align:right;">{{user.stored_subscriber_count}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% if pos2 > 25 %}
|
||||
<tr style="border-top:1px solid var(--primary)">
|
||||
<td style="font-weight:bold;">{{pos2}}</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; text-align:right;">{{v.stored_subscriber_count}}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
<pre>
|
||||
|
||||
|
@ -136,6 +157,13 @@
|
|||
<td style="font-weight:bold; text-align:right;">{{user.post_count}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% if pos3 > 25 %}
|
||||
<tr style="border-top:1px solid var(--primary)">
|
||||
<td style="font-weight:bold;">{{pos3}}</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; text-align:right;">{{v.post_count}}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
<pre>
|
||||
|
||||
|
@ -161,6 +189,13 @@
|
|||
<td style="font-weight:bold; text-align:right;">{{user.comment_count}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% if pos4 > 25 %}
|
||||
<tr style="border-top:1px solid var(--primary)">
|
||||
<td style="font-weight:bold;">{{pos4}}</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; text-align:right;">{{v.comment_count}}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue