From 75d83b7a4bb9b3959b756b9918350f147ff5524b Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 23 Sep 2021 23:42:02 +0200 Subject: [PATCH] fds --- files/classes/submission.py | 6 ------ files/routes/front.py | 8 ++------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/files/classes/submission.py b/files/classes/submission.py index 0fb8bc78e..de593ac72 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -169,12 +169,6 @@ class Submission(Base): def score(self): return self.upvotes - self.downvotes - @property - @lazy - def hotscore(self): - return 10000000*(self.upvotes - self.downvotes + 1)/(((self.age+3600)/1000)**(1.35)) - - @property @lazy def fullname(self): diff --git a/files/routes/front.py b/files/routes/front.py index 23f7d4853..76f3582b5 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -171,10 +171,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=' posts = posts.join(Submission.author).filter(User.shadowbanned == False) if sort == "hot": - posts = sorted(posts.all(), key=lambda x: x.hotscore, reverse=True) - firstrange = 25 * (page - 1) - secondrange = firstrange+100 - posts = posts[firstrange:secondrange] + posts = posts.order_by(-10000000*(Submission.upvotes - Submission.downvotes + 1)/(((int(time.time()) - Submission.created_utc + 3600)/1000)*(1.35))) elif sort == "new": posts = posts.order_by(Submission.created_utc.desc()) elif sort == "old": @@ -188,8 +185,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=' elif sort == "comments": posts = posts.order_by(Submission.comment_count.desc()) - if sort != "hot": posts = posts.offset(25 * (page - 1)).limit(26).all() - + posts = posts.offset(25 * (page - 1)).limit(26).all() next_exists = (len(posts) > 25)