From b5c255cade6f786c964a8c5153c257eb05e6e2ae Mon Sep 17 00:00:00 2001 From: lza_menace Date: Wed, 26 Aug 2020 21:47:14 -0700 Subject: [PATCH] fixing top posts page to actually sort --- suchwow/routes/post.py | 7 ++----- suchwow/templates/post/top.html | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/suchwow/routes/post.py b/suchwow/routes/post.py index 091efdc..5b14a43 100644 --- a/suchwow/routes/post.py +++ b/suchwow/routes/post.py @@ -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/") def read(id): diff --git a/suchwow/templates/post/top.html b/suchwow/templates/post/top.html index a513886..40aabef 100644 --- a/suchwow/templates/post/top.html +++ b/suchwow/templates/post/top.html @@ -10,8 +10,8 @@ {% if posts %} {% else %}