From dd0a6a62d0fea09cbb5b840d28a10302d11ed672 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 10 Oct 2021 16:19:07 +0200 Subject: [PATCH] dfsfd --- files/classes/user.py | 2 +- files/routes/front.py | 6 +++--- files/routes/posts.py | 4 ++-- files/routes/search.py | 4 ++-- files/routes/users.py | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 7c7581dbf..bc8d47b5c 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -266,7 +266,7 @@ class User(Base): elif sort == "old": posts = posts.order_by(Submission.created_utc.asc()) elif sort == "controversial": - posts = posts.order_by(-1 * Submission.upvotes * min(Submission.downvotes, 1)) + posts = posts.order_by(-1 * Submission.upvotes * func.min(Submission.downvotes, 1)) elif sort == "top": posts = posts.order_by(Submission.downvotes - Submission.upvotes) elif sort == "bottom": diff --git a/files/routes/front.py b/files/routes/front.py index ba1db97bb..d6f08e293 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -199,7 +199,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=' elif sort == "old": posts = posts.order_by(Submission.created_utc.asc()) elif sort == "controversial": - posts = posts.order_by(-1 * Submission.upvotes * min(Submission.downvotes, 1)) + posts = posts.order_by(-1 * Submission.upvotes * func.min(Submission.downvotes, 1)) elif sort == "top": posts = posts.order_by(Submission.downvotes - Submission.upvotes) elif sort == "bottom": @@ -291,7 +291,7 @@ def changeloglist(v=None, sort="new", page=1 ,t="all"): elif sort == "old": posts = posts.order_by(Submission.created_utc.asc()) elif sort == "controversial": - posts = posts.order_by(-1 * Submission.upvotes * min(Submission.downvotes, 1)) + posts = posts.order_by(-1 * Submission.upvotes * func.min(Submission.downvotes, 1)) elif sort == "top": posts = posts.order_by(Submission.downvotes - Submission.upvotes) elif sort == "bottom": @@ -361,7 +361,7 @@ def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all"): elif sort == "old": comments = comments.order_by(Comment.created_utc.asc()) elif sort == "controversial": - comments = comments.order_by(-1 * Comment.upvotes * min(Comment.downvotes, 1)) + comments = comments.order_by(-1 * Comment.upvotes * func.min(Comment.downvotes, 1)) elif sort == "top": comments = comments.order_by(Comment.downvotes - Comment.upvotes) elif sort == "bottom": diff --git a/files/routes/posts.py b/files/routes/posts.py index 67814215f..bdc7041a6 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -143,7 +143,7 @@ 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 * min(Comment.downvotes, 1)) + comments = comments.order_by(-1 * Comment.upvotes * func.min(Comment.downvotes, 1)) elif sort == "top": comments = comments.order_by(Comment.downvotes - Comment.upvotes) elif sort == "bottom": @@ -168,7 +168,7 @@ 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 * min(Comment.downvotes, 1)) + comments = comments.order_by(-1 * Comment.upvotes * func.min(Comment.downvotes, 1)) elif sort == "top": comments = comments.order_by(Comment.downvotes - Comment.upvotes) elif sort == "bottom": diff --git a/files/routes/search.py b/files/routes/search.py index c3abb10f0..f745c703d 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -132,7 +132,7 @@ def searchposts(v): elif sort == "old": posts = posts.order_by(Submission.created_utc.asc()) elif sort == "controversial": - posts = posts.order_by(-1 * Submission.upvotes * min(Submission.downvotes, 1)) + posts = posts.order_by(-1 * Submission.upvotes * func.min(Submission.downvotes, 1)) elif sort == "top": posts = posts.order_by(Submission.downvotes - Submission.upvotes) elif sort == "bottom": @@ -235,7 +235,7 @@ def searchcomments(v): elif sort == "old": comments = comments.order_by(Comment.created_utc.asc()) elif sort == "controversial": - comments = comments.order_by(-1 * Comment.upvotes * min(Comment.downvotes, 1)) + comments = comments.order_by(-1 * Comment.upvotes * func.min(Comment.downvotes, 1)) elif sort == "top": comments = comments.order_by(Comment.downvotes - Comment.upvotes) elif sort == "bottom": diff --git a/files/routes/users.py b/files/routes/users.py index f2fbb1a05..44834530d 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -572,7 +572,7 @@ def u_username_comments(username, v=None): elif sort == "old": comments = comments.order_by(Comment.created_utc.asc()) elif sort == "controversial": - comments = comments.order_by(-1 * Comment.upvotes * min(Comment.downvotes, 1)) + comments = comments.order_by(-1 * Comment.upvotes * func.min(Comment.downvotes, 1)) elif sort == "top": comments = comments.order_by(Comment.downvotes - Comment.upvotes) elif sort == "bottom":