master
Aevann1 2022-01-31 04:36:34 +02:00
parent 5dcc4b0970
commit 47e714ffa0
1 changed files with 8 additions and 8 deletions

View File

@ -179,8 +179,8 @@ def post_id(pid, anything=None, v=None):
elif sort == "bottom": elif sort == "bottom":
comments = comments.order_by(Comment.upvotes - Comment.downvotes) comments = comments.order_by(Comment.upvotes - Comment.downvotes)
first = [c[0] for c in comments.filter(Comment.slots_result == None, Comment.blackjack_result == None).all()] first = [c[0] for c in comments.filter(Comment.slots_result == None, Comment.blackjack_result == None, func.length(Comment.body) > 20).all()]
second = [c[0] for c in comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None)).all()] second = [c[0] for c in comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None), func.length(Comment.body) <= 20).all()]
comments = first + second comments = first + second
else: else:
pinned = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.is_pinned != None).all() pinned = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.is_pinned != None).all()
@ -198,8 +198,8 @@ def post_id(pid, anything=None, v=None):
elif sort == "bottom": elif sort == "bottom":
comments = comments.order_by(Comment.upvotes - Comment.downvotes) comments = comments.order_by(Comment.upvotes - Comment.downvotes)
first = comments.filter(Comment.slots_result == None, Comment.blackjack_result == None).all() first = comments.filter(Comment.slots_result == None, Comment.blackjack_result == None, func.length(Comment.body) > 20).all()
second = comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None)).all() second = comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None), func.length(Comment.body) <= 20).all()
comments = first + second comments = first + second
offset = 0 offset = 0
@ -302,8 +302,8 @@ def viewmore(v, pid, sort, offset):
elif sort == "bottom": elif sort == "bottom":
comments = comments.order_by(Comment.upvotes - Comment.downvotes) comments = comments.order_by(Comment.upvotes - Comment.downvotes)
first = [c[0] for c in comments.filter(Comment.slots_result == None, Comment.blackjack_result == None).all()] first = [c[0] for c in comments.filter(Comment.slots_result == None, Comment.blackjack_result == None, func.length(Comment.body) > 20).all()]
second = [c[0] for c in comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None)).all()] second = [c[0] for c in comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None), func.length(Comment.body) <= 20).all()]
comments = first + second comments = first + second
comments = comments[offset:] comments = comments[offset:]
else: else:
@ -320,8 +320,8 @@ def viewmore(v, pid, sort, offset):
elif sort == "bottom": elif sort == "bottom":
comments = comments.order_by(Comment.upvotes - Comment.downvotes) comments = comments.order_by(Comment.upvotes - Comment.downvotes)
first = comments.filter(Comment.slots_result == None, Comment.blackjack_result == None).all() first = comments.filter(Comment.slots_result == None, Comment.blackjack_result == None, func.length(Comment.body) > 20).all()
second = comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None)).all() second = comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None), func.length(Comment.body) <= 20).all()
comments = first + second comments = first + second
comments = comments[offset:] comments = comments[offset:]