fixing top posts page to actually sort

This commit is contained in:
lza_menace 2020-08-26 21:47:14 -07:00
parent 299ef8864b
commit b5c255cade
2 changed files with 4 additions and 7 deletions

View File

@ -22,11 +22,8 @@ def top():
transfers.append(wownero.from_atomic(xfer["amount"]))
total = sum(transfers)
if total > 0:
top_posts[post.id] = {
"post": post,
"total": float(total)
}
return render_template("post/top.html", posts=top_posts)
top_posts[float(total)] = post
return render_template("post/top.html", posts=sorted(top_posts.items(), reverse=True))
@bp.route("/post/<id>")
def read(id):

View File

@ -10,8 +10,8 @@
{% if posts %}
<ul style="list-style-type:none;">
{% for post in posts | sort(attribute='total') %}
<li>#{{ posts[post].post.id }} - <a href="{{ url_for('post.read', id=posts[post].post.id) }}">{{ posts[post].post.title }}</a> - {{ posts[post].post.submitter }} - {{ posts[post].total }} WOW received</li>
{% for post in posts %}
<li>#{{ post[1].id }} - <a href="{{ url_for('post.read', id=post[1].id) }}">{{ post[1].title }}</a> - {{ post[1].submitter }} - {{ post[0] }} WOW received</li>
{% endfor %}
</ul>
{% else %}