fix sorting by bottom for comments

master
Aevann1 2022-06-26 08:16:05 +02:00
parent 81243b48dd
commit b450d5bb8c
1 changed files with 1 additions and 1 deletions

View File

@ -36,7 +36,7 @@ def sort_comments(sort, comments):
elif sort == 'controversial': elif sort == 'controversial':
return comments.order_by((Comment.upvotes+1)/(Comment.downvotes+1) + (Comment.downvotes+1)/(Comment.upvotes+1), Comment.downvotes.desc(), Comment.id.desc()) return comments.order_by((Comment.upvotes+1)/(Comment.downvotes+1) + (Comment.downvotes+1)/(Comment.upvotes+1), Comment.downvotes.desc(), Comment.id.desc())
elif sort == "bottom": elif sort == "bottom":
return comments.order_by(Comment.realupvotes, Comment.id.desc()) return comments.order_by(Comment.upvotes - Comment.downvotes)
else: else:
return comments.order_by(Comment.realupvotes.desc(), Comment.id.desc()) return comments.order_by(Comment.realupvotes.desc(), Comment.id.desc())