mirror of
https://git.wownero.com/lza_menace/suchwow.git
synced 2024-08-15 01:03:19 +00:00
adjustments to top posters
This commit is contained in:
parent
309abaac83
commit
dced6d53bf
2 changed files with 19 additions and 16 deletions
|
@ -13,19 +13,24 @@ bp = Blueprint("leaderboard", "leaderboard")
|
|||
@bp.route("/leaderboards/top_posters")
|
||||
def top_posters():
|
||||
top_posters = {}
|
||||
posts = Post.select().where(Post.approved==True)
|
||||
for post in posts:
|
||||
transfers = []
|
||||
incoming = wownero.Wallet().incoming_transfers(post.account_index)
|
||||
if "transfers" in incoming:
|
||||
for xfer in incoming["transfers"]:
|
||||
transfers.append(wownero.from_atomic(xfer["amount"]))
|
||||
total = sum(transfers)
|
||||
if post.submitter not in top_posters:
|
||||
top_posters[post.submitter] = {"amount": 0, "posts": []}
|
||||
posts = rw_cache('top_posters')
|
||||
if not posts:
|
||||
posts = Post.select().where(Post.approved==True)
|
||||
for post in posts:
|
||||
transfers = []
|
||||
incoming = wownero.Wallet().incoming_transfers(post.account_index)
|
||||
if "transfers" in incoming:
|
||||
for xfer in incoming["transfers"]:
|
||||
transfers.append(wownero.from_atomic(xfer["amount"]))
|
||||
total = sum(transfers)
|
||||
if post.submitter not in top_posters:
|
||||
top_posters[post.submitter] = {"amount": 0, "posts": []}
|
||||
|
||||
top_posters[post.submitter]["amount"] += float(total)
|
||||
top_posters[post.submitter]["posts"].append(post)
|
||||
top_posters[post.submitter]["amount"] += float(total)
|
||||
top_posters[post.submitter]["posts"].append(post)
|
||||
rw_cache('top_posters', top_posters)
|
||||
else:
|
||||
top_posters = posts
|
||||
|
||||
return render_template("leaderboard.html", posters=top_posters)
|
||||
|
||||
|
|
|
@ -2,11 +2,9 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
<div class="container" style="text-align:center;">
|
||||
<div class="container content" style="text-align:center;">
|
||||
|
||||
<div class="title">
|
||||
<h3>{% block title %}Top Posters{% endblock %}</h3>
|
||||
</div>
|
||||
<h1>Top Posters</h1>
|
||||
|
||||
{% if posters %}
|
||||
<table class="table table-striped">
|
||||
|
|
Loading…
Reference in a new issue