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

@ -167,11 +167,11 @@ def post_id(pid, anything=None, 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.realupvotes - Comment.downvotes)
comments = comments.order_by(-Comment.upvotes - Comment.downvotes)
elif sort == "bottom":
comments = comments.order_by(Comment.realupvotes - Comment.downvotes)
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
output = []
for c in comments.all():
@ -191,11 +191,11 @@ def post_id(pid, anything=None, 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.realupvotes - Comment.downvotes)
comments = comments.order_by(-Comment.upvotes - Comment.downvotes)
elif sort == "bottom":
comments = comments.order_by(Comment.realupvotes - Comment.downvotes)
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
post.replies = comments.filter(Comment.is_pinned != None).all() + comments.filter(Comment.level == 1, Comment.is_pinned == None).all()