From c0939815ac8c3b5e68e4b3136854fddb72e0cd08 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 23 Sep 2021 21:20:47 +0200 Subject: [PATCH] fsd --- files/classes/user.py | 2 +- files/routes/front.py | 6 +++--- files/routes/posts.py | 4 ++-- files/routes/search.py | 2 +- files/routes/users.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 7f60e703a..196477308 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(Submission.upvotes * Submission.downvotes) + posts = posts.order_by(-1 * Submission.upvotes * (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 e2a41f3a3..d6797d42d 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -180,7 +180,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(Submission.upvotes * Submission.downvotes) + posts = posts.order_by(-1 * Submission.upvotes * (Submission.downvotes+1)) elif sort == "top": posts = posts.order_by(Submission.downvotes - Submission.upvotes) elif sort == "bottom": @@ -292,7 +292,7 @@ def changeloglist(v=None, sort="new", page=1 ,t="all", **kwargs): elif sort == "old": posts = posts.order_by(Submission.created_utc.asc()) elif sort == "controversial": - posts = posts.order_by(Submission.upvotes * Submission.downvotes) + posts = posts.order_by(-1 * Submission.upvotes * (Submission.downvotes+1)) elif sort == "top": posts = posts.order_by(Submission.downvotes - Submission.upvotes) elif sort == "bottom": @@ -393,7 +393,7 @@ def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", **kwargs): elif sort == "old": comments = comments.order_by(Comment.created_utc.asc()) elif sort == "controversial": - comments = comments.order_by(Comment.upvotes * Comment.downvotes) + comments = comments.order_by(-1 * Comment.upvotes * (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 36b344e50..f7bed4b96 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -152,7 +152,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(Comment.upvotes * Comment.downvotes) + comments = comments.order_by(-1 * Comment.upvotes * (Comment.downvotes+1)) elif sort == "top": comments = comments.order_by(Comment.downvotes - Comment.upvotes) elif sort == "bottom": @@ -177,7 +177,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(Comment.upvotes * Comment.downvotes) + comments = comments.order_by(-1 * Comment.upvotes * (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 09489c05c..facd80666 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -153,7 +153,7 @@ def searchposts(v): elif sort == "old": posts = posts.order_by(Submission.created_utc.asc()) elif sort == "controversial": - posts = posts.order_by(Submission.upvotes * Submission.downvotes) + posts = posts.order_by(-1 * Submission.upvotes * (Submission.downvotes+1)) elif sort == "top": posts = posts.order_by(Submission.downvotes - Submission.upvotes) elif sort == "bottom": diff --git a/files/routes/users.py b/files/routes/users.py index d97e3ae41..6acc04866 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -580,7 +580,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(Comment.upvotes * Comment.downvotes) + comments = comments.order_by(-1 * Comment.upvotes * (Comment.downvotes+1)) elif sort == "top": comments = comments.order_by(Comment.downvotes - Comment.upvotes) elif sort == "bottom":