From 45b62e9305b37d6e6dcb31d541fe0d804e37b20c Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Wed, 21 Feb 2024 19:59:50 +1300 Subject: [PATCH] ranking tweak --- app/community/routes.py | 2 +- app/topic/routes.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/community/routes.py b/app/community/routes.py index 0350e43c..48ca6196 100644 --- a/app/community/routes.py +++ b/app/community/routes.py @@ -156,7 +156,7 @@ def show_community(community: Community): posts = posts.filter(or_(Post.domain_id.not_in(domains_ids), Post.domain_id == None)) if sort == '' or sort == 'hot': - posts = posts.order_by(desc(Post.ranking)) + posts = posts.order_by(desc(Post.ranking)).order_by(desc(Post.posted_at)) elif sort == 'top': posts = posts.filter(Post.posted_at > utcnow() - timedelta(days=7)).order_by(desc(Post.score)) elif sort == 'new': diff --git a/app/topic/routes.py b/app/topic/routes.py index f80d21a2..8c6559dd 100644 --- a/app/topic/routes.py +++ b/app/topic/routes.py @@ -51,7 +51,7 @@ def show_topic(topic_name): # sorting if sort == '' or sort == 'hot': - posts = posts.order_by(desc(Post.ranking)) + posts = posts.order_by(desc(Post.ranking)).order_by(desc(Post.posted_at)) elif sort == 'top': posts = posts.filter(Post.posted_at > utcnow() - timedelta(days=7)).order_by(desc(Post.score)) elif sort == 'new':