master
Aevann1 2021-10-10 16:21:31 +02:00
parent dd0a6a62d0
commit 28722f61c7
5 changed files with 9 additions and 9 deletions

View File

@ -266,7 +266,7 @@ class User(Base):
elif sort == "old": elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc()) posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial": elif sort == "controversial":
posts = posts.order_by(-1 * Submission.upvotes * func.min(Submission.downvotes, 1)) posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes)
elif sort == "top": elif sort == "top":
posts = posts.order_by(Submission.downvotes - Submission.upvotes) posts = posts.order_by(Submission.downvotes - Submission.upvotes)
elif sort == "bottom": elif sort == "bottom":

View File

@ -199,7 +199,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
elif sort == "old": elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc()) posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial": elif sort == "controversial":
posts = posts.order_by(-1 * Submission.upvotes * func.min(Submission.downvotes, 1)) posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes)
elif sort == "top": elif sort == "top":
posts = posts.order_by(Submission.downvotes - Submission.upvotes) posts = posts.order_by(Submission.downvotes - Submission.upvotes)
elif sort == "bottom": elif sort == "bottom":
@ -291,7 +291,7 @@ def changeloglist(v=None, sort="new", page=1 ,t="all"):
elif sort == "old": elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc()) posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial": elif sort == "controversial":
posts = posts.order_by(-1 * Submission.upvotes * func.min(Submission.downvotes, 1)) posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes)
elif sort == "top": elif sort == "top":
posts = posts.order_by(Submission.downvotes - Submission.upvotes) posts = posts.order_by(Submission.downvotes - Submission.upvotes)
elif sort == "bottom": elif sort == "bottom":
@ -361,7 +361,7 @@ def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all"):
elif sort == "old": elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc()) comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial": elif sort == "controversial":
comments = comments.order_by(-1 * Comment.upvotes * func.min(Comment.downvotes, 1)) comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes)
elif sort == "top": elif sort == "top":
comments = comments.order_by(Comment.downvotes - Comment.upvotes) comments = comments.order_by(Comment.downvotes - Comment.upvotes)
elif sort == "bottom": elif sort == "bottom":

View File

@ -143,7 +143,7 @@ def post_id(pid, anything=None, v=None):
elif sort == "old": elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc()) comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial": elif sort == "controversial":
comments = comments.order_by(-1 * Comment.upvotes * func.min(Comment.downvotes, 1)) comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes)
elif sort == "top": elif sort == "top":
comments = comments.order_by(Comment.downvotes - Comment.upvotes) comments = comments.order_by(Comment.downvotes - Comment.upvotes)
elif sort == "bottom": elif sort == "bottom":
@ -168,7 +168,7 @@ def post_id(pid, anything=None, v=None):
elif sort == "old": elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc()) comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial": elif sort == "controversial":
comments = comments.order_by(-1 * Comment.upvotes * func.min(Comment.downvotes, 1)) comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes)
elif sort == "top": elif sort == "top":
comments = comments.order_by(Comment.downvotes - Comment.upvotes) comments = comments.order_by(Comment.downvotes - Comment.upvotes)
elif sort == "bottom": elif sort == "bottom":

View File

@ -132,7 +132,7 @@ def searchposts(v):
elif sort == "old": elif sort == "old":
posts = posts.order_by(Submission.created_utc.asc()) posts = posts.order_by(Submission.created_utc.asc())
elif sort == "controversial": elif sort == "controversial":
posts = posts.order_by(-1 * Submission.upvotes * func.min(Submission.downvotes, 1)) posts = posts.order_by(-1 * Submission.upvotes * Submission.downvotes)
elif sort == "top": elif sort == "top":
posts = posts.order_by(Submission.downvotes - Submission.upvotes) posts = posts.order_by(Submission.downvotes - Submission.upvotes)
elif sort == "bottom": elif sort == "bottom":
@ -235,7 +235,7 @@ def searchcomments(v):
elif sort == "old": elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc()) comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial": elif sort == "controversial":
comments = comments.order_by(-1 * Comment.upvotes * func.min(Comment.downvotes, 1)) comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes)
elif sort == "top": elif sort == "top":
comments = comments.order_by(Comment.downvotes - Comment.upvotes) comments = comments.order_by(Comment.downvotes - Comment.upvotes)
elif sort == "bottom": elif sort == "bottom":

View File

@ -572,7 +572,7 @@ def u_username_comments(username, v=None):
elif sort == "old": elif sort == "old":
comments = comments.order_by(Comment.created_utc.asc()) comments = comments.order_by(Comment.created_utc.asc())
elif sort == "controversial": elif sort == "controversial":
comments = comments.order_by(-1 * Comment.upvotes * func.min(Comment.downvotes, 1)) comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes)
elif sort == "top": elif sort == "top":
comments = comments.order_by(Comment.downvotes - Comment.upvotes) comments = comments.order_by(Comment.downvotes - Comment.upvotes)
elif sort == "bottom": elif sort == "bottom":