adjustments to top posters

This commit is contained in:
lza_menace 2021-05-05 02:00:36 -07:00
parent 309abaac83
commit dced6d53bf
2 changed files with 19 additions and 16 deletions

View file

@ -13,6 +13,8 @@ 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 = rw_cache('top_posters')
if not posts:
posts = Post.select().where(Post.approved==True) posts = Post.select().where(Post.approved==True)
for post in posts: for post in posts:
transfers = [] transfers = []
@ -26,6 +28,9 @@ def top_posters():
top_posters[post.submitter]["amount"] += float(total) top_posters[post.submitter]["amount"] += float(total)
top_posters[post.submitter]["posts"].append(post) 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)

View file

@ -2,11 +2,9 @@
{% block content %} {% block content %}
<div class="container" style="text-align:center;"> <div class="container content" style="text-align:center;">
<div class="title"> <h1>Top Posters</h1>
<h3>{% block title %}Top Posters{% endblock %}</h3>
</div>
{% if posters %} {% if posters %}
<table class="table table-striped"> <table class="table table-striped">