This commit is contained in:
Aevann1 2021-11-30 16:18:16 +02:00
parent 4009148ff1
commit dd4fb5b411
10 changed files with 50 additions and 33 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.upvotes * Comment.downvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.realupvotes * Comment.realdownvotes * Comment.downvotes)
elif sort == "top":
comments = comments.order_by(-Comment.upvotes - Comment.downvotes)
comments = comments.order_by(-Comment.realupvotes - Comment.realdownvotes)
elif sort == "bottom":
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
comments = comments.order_by(Comment.realupvotes - Comment.realdownvotes)
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.upvotes * Comment.downvotes * Comment.downvotes)
comments = comments.order_by(-1 * Comment.realupvotes * Comment.realdownvotes * Comment.downvotes)
elif sort == "top":
comments = comments.order_by(-Comment.upvotes - Comment.downvotes)
comments = comments.order_by(-Comment.realupvotes - Comment.realdownvotes)
elif sort == "bottom":
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
comments = comments.order_by(Comment.realupvotes - Comment.realdownvotes)
post.replies = comments.filter(Comment.is_pinned != None).all() + comments.filter(Comment.level == 1, Comment.is_pinned == None).all()