From 710308dd0086c7246c440f291aacfb35e9dae1d7 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 13 May 2023 06:31:45 +0300 Subject: [PATCH] do this https://rdrama.net/h/changelog/post/165657/changelog-megathread-marseynotes/4104704#context --- files/helpers/sorting_and_time.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/helpers/sorting_and_time.py b/files/helpers/sorting_and_time.py index cb5b9eb62..8c92cc4ec 100644 --- a/files/helpers/sorting_and_time.py +++ b/files/helpers/sorting_and_time.py @@ -47,6 +47,8 @@ def sort_objects(sort, objects, cls): return objects.order_by(cls.created_utc.desc()) elif sort == "old": return objects.order_by(cls.created_utc) + elif sort == "controversial" and cls.__name__ == "Submission": + return objects.order_by((cls.upvotes+1)/(cls.downvotes+1) + (cls.downvotes+1)/(cls.upvotes+1) - cls.comment_count/500, cls.downvotes.desc(), cls.created_utc.desc()) elif sort == "controversial": return objects.order_by((cls.upvotes+1)/(cls.downvotes+1) + (cls.downvotes+1)/(cls.upvotes+1), cls.downvotes.desc(), cls.created_utc.desc()) elif sort == "bottom":