From 3c26d4da8078eb111eb7948bfda34d16ce8343fa Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 7 Sep 2023 23:08:10 +0300 Subject: [PATCH] sort removed and deleted comments too (instead of older -> newer) --- files/helpers/sorting_and_time.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/helpers/sorting_and_time.py b/files/helpers/sorting_and_time.py index c1a43b9b4..475ae4946 100644 --- a/files/helpers/sorting_and_time.py +++ b/files/helpers/sorting_and_time.py @@ -1,6 +1,7 @@ import time from sqlalchemy.sql import func +from sqlalchemy.sql.sqltypes import * from flask import g from files.helpers.config.const import * @@ -30,7 +31,7 @@ def apply_time_filter(t, objects, cls): def sort_objects(sort, objects, cls): if sort == 'hot': if not (SITE == 'watchpeopledie.tv' and g.v and g.v.id == GTIX_ID): - objects = objects.order_by(cls.is_banned, cls.deleted_utc) + objects = objects.order_by(func.cast(cls.is_banned, Boolean), func.cast(cls.deleted_utc, Boolean)) ti = int(time.time()) + 3600 metric = cls.realupvotes + 1