From 6f6c59e7b3531cc9d97b61ec6d3fa3f739ce0dd8 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 22 Jul 2023 19:00:25 +0300 Subject: [PATCH] remove bump sort since it times out when combined with the "all" filter --- files/classes/post.py | 2 -- files/helpers/config/const.py | 2 +- files/helpers/sorting_and_time.py | 2 -- files/templates/home.html | 2 -- 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/files/classes/post.py b/files/classes/post.py index 56bbb137e..9b514735e 100644 --- a/files/classes/post.py +++ b/files/classes/post.py @@ -71,8 +71,6 @@ class Post(Base): subr = relationship("Sub", primaryjoin="foreign(Post.sub)==remote(Sub.name)") options = relationship("PostOption", order_by="PostOption.id") - bump_utc = deferred(Column(Integer, server_default=FetchedValue())) - def __init__(self, *args, **kwargs): if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time()) super().__init__(*args, **kwargs) diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index d0ca23910..8ee850fb6 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -322,7 +322,7 @@ THEMES = ["4chan","classic","classic_dark","coffee","dark","dramblr","light","mi LIGHT_THEMES = ["4chan","classic","coffee","light","win98"] BACKGROUND_CATEGORIES = ["glitter", "anime", "fantasy", "solarpunk", "pixelart"] COMMENT_SORTS = ["hot", "new", "old", "top", "bottom", "controversial", "saves"] -SORTS = COMMENT_SORTS + ["bump", "comments", "views", "subscriptions", "saves"] +SORTS = COMMENT_SORTS + ["comments", "views", "subscriptions", "saves"] TIME_FILTERS = ["hour", "day", "week", "month", "year", "all"] PAGE_SIZES = (10, 25, 50, 100) diff --git a/files/helpers/sorting_and_time.py b/files/helpers/sorting_and_time.py index bc442b86e..ab2165849 100644 --- a/files/helpers/sorting_and_time.py +++ b/files/helpers/sorting_and_time.py @@ -33,8 +33,6 @@ def sort_objects(sort, objects, cls): return objects.order_by(-1000000*(metric + 1)/(func.power(((ti - cls.created_utc)/1000), 1.35)), 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": - return objects.filter(cls.comment_count > 1).order_by(cls.bump_utc.desc(), cls.created_utc.desc()) elif sort == "comments" and cls.__name__ == "Post": return objects.order_by(cls.comment_count.desc(), cls.created_utc.desc()) elif sort == "subscriptions" and cls.__name__ == "Post": diff --git a/files/templates/home.html b/files/templates/home.html index 1db53a49d..b919e0617 100644 --- a/files/templates/home.html +++ b/files/templates/home.html @@ -106,7 +106,6 @@