From cf479d23530dce19075ffd110dbcf0cf23172947 Mon Sep 17 00:00:00 2001 From: Simple_Not <44047940+moonbaseDelta@users.noreply.github.com> Date: Fri, 26 Jan 2024 19:05:33 +1000 Subject: [PATCH] order-bug fix --- app.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 562f127..80d8ad9 100644 --- a/app.py +++ b/app.py @@ -60,7 +60,7 @@ def page_posts_from_db(target_post_id=None): postos = db.collection('posts') postos = [ p for p in postos] - postos = sorted(postos, key=lambda posto: posto['_key'], reverse=False) + postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False) if not target_post_id: target_post_id = postos[0]['_key'] @@ -73,7 +73,7 @@ def answer_post(target_post_id): postos = db.collection('posts') postos = [ p for p in postos] - postos = sorted(postos, key=lambda posto: posto['_key'], reverse=False) + postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False) if not target_post_id: target_post_id = postos[0]['_key'] @@ -144,8 +144,8 @@ def post_to_post(post_key): UPDATE ppp WITH { answers_list : [ children[*]._key, children[*].answers_num, children[*].children_num ] } IN posts""" ) - postos = db.collection('posts') - postos = sorted(postos, key=lambda posto: posto['_key'], reverse=False) + postos = db.collection('posts') + postos = sorted(postos, key=lambda posto: int(posto['_key']), reverse=False) return render_template("i-posts.html", host_id=docker_short_id, postos=postos)