From 34e29a6ab38c662ca5ab32fdf815430f4e6deaae Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 21 Feb 2022 08:13:05 +0200 Subject: [PATCH] gf --- files/classes/submission.py | 3 +-- files/routes/front.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/files/classes/submission.py b/files/classes/submission.py index d31ee7776..597878e78 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -5,7 +5,7 @@ import time from urllib.parse import urlparse from flask import render_template from sqlalchemy import * -from sqlalchemy.orm import relationship, deferred +from sqlalchemy.orm import relationship from files.__main__ import Base from files.helpers.const import * from files.helpers.lazy import lazy @@ -60,7 +60,6 @@ class Submission(Base): comments = relationship("Comment", primaryjoin="Comment.parent_submission==Submission.id") subr = relationship("Sub", primaryjoin="foreign(Submission.sub)==remote(Sub.name)", viewonly=True) - comment_count_distinct = deferred(Column(Float, server_default=FetchedValue())) def __init__(self, *args, **kwargs): if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time()) diff --git a/files/routes/front.py b/files/routes/front.py index d7ec8f1ff..b805f2af4 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -322,7 +322,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false" if sort == "hot": ti = int(time.time()) + 3600 - posts = posts.order_by(-1000000*(Submission.realupvotes + 1 + Submission.comment_count_distinct/2 + (func.length(Submission.body_html)-func.length(func.replace(Submission.body_html,'',''))))/(func.power(((ti - Submission.created_utc)/1000), 1.23))) + posts = posts.order_by(-1000000*(Submission.realupvotes + 1 + Submission.comment_count/5 + (func.length(Submission.body_html)-func.length(func.replace(Submission.body_html,'',''))))/(func.power(((ti - Submission.created_utc)/1000), 1.23))) elif sort == "new": posts = posts.order_by(Submission.created_utc.desc()) elif sort == "old":