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':