add more data for jannies in /votes page (will use that in polls)

remotes/1693045480750635534/spooky-22
Aevann1 2022-07-01 01:39:09 +02:00
parent 11d0163740
commit 1362278cb4
2 changed files with 18 additions and 0 deletions

View File

@ -40,6 +40,19 @@ def admin_vote_info_get(v):
downs = g.db.query(CommentVote).filter_by(comment_id=thing_id, vote_type=-1 ).order_by(CommentVote.created_utc).all()
if v.admin_level:
up_ids = [x[0] for x in g.db.query(CommentVote.user_id).filter_by(comment_id=thing_id, vote_type=1).order_by(CommentVote.created_utc).all()]
total_ups = g.db.query(func.sum(User.truecoins)).filter(User.id.in_(up_ids)).scalar()
patrons_ups = g.db.query(User).filter(User.id.in_(up_ids), User.patron > 0).count()
return render_template("votes.html",
v=v,
thing=thing,
ups=ups,
downs=downs,
total_ups=total_ups,
patrons_ups=patrons_ups)
else: abort(400)
return render_template("votes.html",

View File

@ -22,6 +22,11 @@
<p><b>Upvotes: </b>{{ups | length}}</p>
<p><b>Downvotes: </b>{{downs | length}}</p>
{% if v.admin_level %}
<p><b>Total Truescore: </b>{{total_ups}}</p>
<p><b>Total Paypigs: </b>{{patrons_ups}}</p>
{% endif %}
<h2>Upvotes</h2>
<div class="overflow-x-auto">
<table class="table table-striped mb-5">