From 631626f07e6f0d112f9cb4c4339456bc4ad558a8 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 6 Aug 2021 17:36:54 +0200 Subject: [PATCH] fd --- files/routes/comments.py | 11 +++-------- files/routes/front.py | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index b2910b9a7..537765c03 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -75,11 +75,6 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): current_ids = [comment.id] - exile=g.db.query(ModAction - ).filter_by( - kind="exile_user" - ).distinct(ModAction.target_comment_id).subquery() - for i in range(6 - context): if v: blocking = v.blocking.subquery() @@ -103,15 +98,15 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): ) if sort == "top": - comments = sorted(comments.all(), key=lambda x: x.score, reverse=True) + comments = sorted(comments.all(), key=lambda x: x[0].score, reverse=True) elif sort == "bottom": - comments = sorted(comments.all(), key=lambda x: x.score) + comments = sorted(comments.all(), key=lambda x: x[0].score) elif sort == "new": comments = comments.order_by(Comment.created_utc.desc()).all() elif sort == "old": comments = comments.order_by(Comment.created_utc.asc()).all() elif sort == "controversial": - comments = sorted(comments.all(), key=lambda x: x.score_disputed, reverse=True) + comments = sorted(comments.all(), key=lambda x: x[0].score_disputed, reverse=True) elif sort == "random": c = comments.all() comments = random.sample(c, k=len(c)) diff --git a/files/routes/front.py b/files/routes/front.py index 75226ea5a..752c84ea7 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -323,7 +323,7 @@ def changelog(v): def random_post(v): if v and v.is_banned and not v.unban_utc: return render_template("seized.html") - x = g.db.query(Submission).filter(Submission.deleted_utc == 0, Submission.is_banned == False, Submission.score > 20) + x = g.db.query(Submission).filter(Submission.deleted_utc == 0, Submission.is_banned == False) total = x.count() n = random.randint(0, total - 1)