forked from rDrama/rDrama
bbb
parent
6ee5fc968a
commit
de00510fca
|
@ -321,7 +321,16 @@ def leaderboard(v):
|
||||||
if request.host == 'rdrama.net': users13 = topmakers
|
if request.host == 'rdrama.net': users13 = topmakers
|
||||||
else: users13 = None
|
else: users13 = None
|
||||||
|
|
||||||
return render_template(f"{template}leaderboard.html", v=v, users1=users1, users2=users2, users3=users3, users4=users4, users5=users5, users6=users6, users7=users7, users9=users9, users10=users10, users12=users12, users13=users13)
|
votes1 = g.db.query(Vote.user_id, func.count(Vote.user_id)).filter(Vote.vote_type==1).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).all()
|
||||||
|
votes1 = g.db.query(CommentVote.user_id, func.count(CommentVote.user_id)).filter(CommentVote.vote_type==1).group_by(CommentVote.user_id).order_by(func.count(CommentVote.user_id).desc()).all()
|
||||||
|
votes3 = Counter(dict(votes1)) + Counter(dict(votes2))
|
||||||
|
users14 = g.db.query(User).filter(User.id.in_(votes3.keys())).all()
|
||||||
|
users15 = []
|
||||||
|
for user in users14: users15.append((user, votes3[user.id]))
|
||||||
|
users15 = sorted(users15, key=lambda x: x[1], reverse=True)[:25]
|
||||||
|
|
||||||
|
|
||||||
|
return render_template(f"{template}leaderboard.html", v=v, users1=users1, users2=users2, users3=users3, users4=users4, users5=users5, users6=users6, users7=users7, users9=users9, users10=users10, users12=users12, users13=users13, users15=users15)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/@<username>/css")
|
@app.get("/@<username>/css")
|
||||||
|
|
|
@ -304,4 +304,35 @@
|
||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if users15 %}
|
||||||
|
<pre>
|
||||||
|
|
||||||
|
|
||||||
|
</pre>
|
||||||
|
<h5 style="font-weight:bold;text-align: center;">Top 25 by upvotes given</h5>
|
||||||
|
<pre>
|
||||||
|
|
||||||
|
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<div class="overflow-x-auto"><table class="table table-striped mb-5">
|
||||||
|
<thead class="bg-primary text-white">
|
||||||
|
<tr>
|
||||||
|
<th style="font-weight: bold">#</th>
|
||||||
|
<th style="font-weight: bold">Name</th>
|
||||||
|
<th style="font-weight: bold">Upvotes</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="followers-table">
|
||||||
|
{% for user in users15 %}
|
||||||
|
<tr>
|
||||||
|
<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="/uid/{{user[0].id}}/pic" 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 %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue