From 6b66c632ef7fe2bfb9e88949a056135788309888 Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 4 Sep 2023 21:28:38 +0300 Subject: [PATCH] simpler syntax --- files/helpers/sorting_and_time.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/helpers/sorting_and_time.py b/files/helpers/sorting_and_time.py index ff21b5cde2..4468e55c19 100644 --- a/files/helpers/sorting_and_time.py +++ b/files/helpers/sorting_and_time.py @@ -33,9 +33,9 @@ def sort_objects(sort, objects, cls): if sort == 'hot': ti = int(time.time()) + 3600 - metric = cls.realupvotes + metric = cls.realupvotes + 1 if cls.__name__ == "Post": metric += cls.comment_count/5 - return objects.order_by(-1000000*((metric + 1)/func.power(((ti - cls.created_utc)/1000), 1.4)), cls.created_utc.desc()) + return objects.order_by(-1000000*(metric / func.power(((ti - cls.created_utc)/1000), 1.4)), cls.created_utc.desc()) elif sort == "views" and cls.__name__ == "Post": return objects.order_by(cls.views.desc(), cls.created_utc.desc()) elif sort == "bump" and cls.__name__ == "Post":