|
|
@ -13,19 +13,24 @@ bp = Blueprint("leaderboard", "leaderboard")
|
|
|
|
@bp.route("/leaderboards/top_posters")
|
|
|
|
@bp.route("/leaderboards/top_posters")
|
|
|
|
def top_posters():
|
|
|
|
def top_posters():
|
|
|
|
top_posters = {}
|
|
|
|
top_posters = {}
|
|
|
|
posts = Post.select().where(Post.approved==True)
|
|
|
|
posts = rw_cache('top_posters')
|
|
|
|
for post in posts:
|
|
|
|
if not posts:
|
|
|
|
transfers = []
|
|
|
|
posts = Post.select().where(Post.approved==True)
|
|
|
|
incoming = wownero.Wallet().incoming_transfers(post.account_index)
|
|
|
|
for post in posts:
|
|
|
|
if "transfers" in incoming:
|
|
|
|
transfers = []
|
|
|
|
for xfer in incoming["transfers"]:
|
|
|
|
incoming = wownero.Wallet().incoming_transfers(post.account_index)
|
|
|
|
transfers.append(wownero.from_atomic(xfer["amount"]))
|
|
|
|
if "transfers" in incoming:
|
|
|
|
total = sum(transfers)
|
|
|
|
for xfer in incoming["transfers"]:
|
|
|
|
if post.submitter not in top_posters:
|
|
|
|
transfers.append(wownero.from_atomic(xfer["amount"]))
|
|
|
|
top_posters[post.submitter] = {"amount": 0, "posts": []}
|
|
|
|
total = sum(transfers)
|
|
|
|
|
|
|
|
if post.submitter not in top_posters:
|
|
|
|
top_posters[post.submitter]["amount"] += float(total)
|
|
|
|
top_posters[post.submitter] = {"amount": 0, "posts": []}
|
|
|
|
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)
|
|
|
|
return render_template("leaderboard.html", posters=top_posters)
|
|
|
|
|
|
|
|
|
|
|
|