From 7f87343d7f79a2f2f66c22eaf1b7df88013741ed Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 11 Aug 2023 18:41:57 +0300 Subject: [PATCH] only filter if its not 'all' --- files/helpers/sorting_and_time.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/helpers/sorting_and_time.py b/files/helpers/sorting_and_time.py index a1bc1328a..b156e77e2 100644 --- a/files/helpers/sorting_and_time.py +++ b/files/helpers/sorting_and_time.py @@ -9,6 +9,7 @@ from files.classes.saves import * def apply_time_filter(t, objects, cls): now = int(time.time()) + if t == 'hour': cutoff = now - 3600 elif t == 'day': @@ -20,9 +21,10 @@ def apply_time_filter(t, objects, cls): elif t == 'year': cutoff = now - 31536000 else: - cutoff = 0 + return objects return objects.filter(cls.created_utc >= cutoff) + def sort_objects(sort, objects, cls): if sort == 'hot':