From ab2d9b492dec372a487493159ec719be740d83f0 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 3 Jul 2022 04:40:57 +0200 Subject: [PATCH] add "warm" sorting - exact same as hot but pinned posts are shown in their normal positions instead of the top --- files/routes/front.py | 2 +- files/routes/settings.py | 2 +- files/templates/settings_filters.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/routes/front.py b/files/routes/front.py index 8ed7e7d92..04035a6f8 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -295,7 +295,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false" if request.host == 'rdrama.net': num = 5 else: num = 0.5 - if sort == "hot": + if sort in ("hot","warm"): ti = int(time.time()) + 3600 posts = posts.order_by(-1000000*(Submission.realupvotes + 1 + Submission.comment_count/num)/(func.power(((ti - Submission.created_utc)/1000), 1.23)), Submission.created_utc.desc()) elif sort == "bump": diff --git a/files/routes/settings.py b/files/routes/settings.py index 3c6ea52e5..421f1f91a 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -251,7 +251,7 @@ def settings_profile_post(v): defaultsorting = request.values.get("defaultsorting") if defaultsorting: - if defaultsorting in {"hot", "bump", "new", "old", "comments", "controversial", "top", "bottom"}: + if defaultsorting in {"hot", "warm", "bump", "new", "old", "comments", "controversial", "top", "bottom"}: v.defaultsorting = defaultsorting updated = True else: abort(400) diff --git a/files/templates/settings_filters.html b/files/templates/settings_filters.html index 5cb32c859..e69cacb34 100644 --- a/files/templates/settings_filters.html +++ b/files/templates/settings_filters.html @@ -90,7 +90,7 @@

Change the default sorting for posts.