This commit is contained in:
Aevann1 2021-11-30 18:37:28 +02:00
parent 6ebc74a862
commit 81b9a86be2
8 changed files with 29 additions and 32 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.realdownvotes * Comment.realdownvotes)
comments = comments.order_by(-1 * Comment.realupvotes * Comment.downvotes * Comment.downvotes)
elif sort == "top":
comments = comments.order_by(-Comment.realupvotes - Comment.realdownvotes)
comments = comments.order_by(-Comment.realupvotes - Comment.downvotes)
elif sort == "bottom":
comments = comments.order_by(Comment.realupvotes - Comment.realdownvotes)
comments = comments.order_by(Comment.realupvotes - 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.realdownvotes * Comment.realdownvotes)
comments = comments.order_by(-1 * Comment.realupvotes * Comment.downvotes * Comment.downvotes)
elif sort == "top":
comments = comments.order_by(-Comment.realupvotes - Comment.realdownvotes)
comments = comments.order_by(-Comment.realupvotes - Comment.downvotes)
elif sort == "bottom":
comments = comments.order_by(Comment.realupvotes - Comment.realdownvotes)
comments = comments.order_by(Comment.realupvotes - Comment.downvotes)
post.replies = comments.filter(Comment.is_pinned != None).all() + comments.filter(Comment.level == 1, Comment.is_pinned == None).all()