This commit is contained in:
Aevann1 2021-12-01 01:21:29 +02:00
parent 796c89a5e9
commit 571beef7a5
6 changed files with 30 additions and 30 deletions

View file

@ -690,11 +690,11 @@ def u_username_comments(username, v=None):
elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial":
comments = comments.order_by(-1 * Comment.realupvotes * Comment.downvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes)
elif sort == "top":
comments = comments.order_by(Comment.downvotes - Comment.realupvotes)
comments = comments.order_by(Comment.realupvotes.desc())
elif sort == "bottom":
comments = comments.order_by(Comment.realupvotes - Comment.downvotes)
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
comments = comments.offset(25 * (page - 1)).limit(26).all()
ids = [x.id for x in comments]