ranking tweak

This commit is contained in:
rimu 2024-02-21 19:59:50 +13:00
parent 8fcf2e3a77
commit 45b62e9305
2 changed files with 2 additions and 2 deletions

View file

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

View file

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