remotes/1693045480750635534/spooky-22
Aevann1 2021-08-22 15:15:13 +02:00
parent 530a75bb75
commit 456131b085
3 changed files with 2 additions and 5 deletions

View File

@ -193,7 +193,7 @@ class User(Base, Stndrd, Age_times):
elif sort == "bottom":
submissions = sorted(submissions.all(), key=lambda x: x.score)
elif sort == "comments":
submissions = sorted(submissions.all(), key=lambda x: x.comment_count, reverse=True)
submissions = submissions.order_by(Submission.comment_count.desc()).all()
firstrange = 25 * (page - 1)
secondrange = firstrange + 26

View File

@ -884,9 +884,6 @@ def submit_post(v):
g.db.add(c)
g.db.flush()
new_post.comment_count = g.db.query(Comment).filter_by(parent_submission=new_post.id).count()
g.db.add(new_post)
if "rdrama" in request.host:
if v.id == 995: body = "fuck off carp"
else: body = random.choice(snappyquotes)

View File

@ -127,7 +127,7 @@ def searchlisting(criteria, v=None, page=1, t="None", sort="top", b=None):
elif sort == "bottom":
posts = sorted(posts.all(), key=lambda x: x.score)
elif sort == "comments":
posts = sorted(posts.all(), key=lambda x: x.comment_count, reverse=True)
posts = posts.order_by(Submission.comment_count.desc()).all()
elif sort == "random":
posts = posts.all()
posts = random.sample(posts, k=len(posts))