remotes/1693045480750635534/spooky-22
Aevann1 2021-07-27 02:13:17 +02:00
parent 67a76912fd
commit 9b88a70354
3 changed files with 33 additions and 1 deletions

View File

@ -326,11 +326,13 @@ class User(Base, Stndrd, Age_times):
Comment.deleted_utc == 0).count()
@property
@lazy
def post_count(self):
return self.submissions.filter_by(is_banned=False, deleted_utc=0).count()
@property
@lazy
def comment_count(self):
return self.comments.filter(Comment.parent_submission != None).filter_by(is_banned=False, deleted_utc=0).count()

View File

@ -182,7 +182,8 @@ def frontlist(v=None, sort="hot", page=1,t="all", ids_only=True, filter_words=''
def front_all(v):
if v and v.is_banned and not v.unban_utc: return render_template("seized.html")
page = int(request.args.get("page") or 1)
try: page = int(request.args.get("page") or 1)
except: abort(400)
# prevent invalid paging
page = max(page, 1)

View File

@ -47,4 +47,33 @@
</tr>
{% endfor %}
</table>
<pre>
</pre>
<h5 style="font-weight:bold;">Top 10 dramatards by post count</h5>
<pre>
</pre>
<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; text-align:right;">Post count</th>
</tr>
</thead>
{% for user in users3 %}
<tr>
<td style="font-weight:bold;">{{users3.index(user)+1}}</td>
<td><a style="color:#{{user.namecolor}}; font-weight:bold;" href="/@{{user.username}}">{{user.username}}</a></td>
<td style="font-weight:bold; text-align:right;">{{user.post_count}}</td>
</tr>
{% endfor %}
</table>
<pre>
</pre>
{% endblock %}