This commit is contained in:
Aevann1 2021-08-06 14:47:25 +02:00
parent effafc8288
commit d2b77cba16
3 changed files with 5 additions and 5 deletions

View file

@ -128,7 +128,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 = posts.order_by(Submission.comment_count.desc()).all()
posts = sorted(posts.all(), key=lambda x: x.comment_count, reverse=True)
elif sort == "random":
posts = posts.all()
posts = random.sample(posts, k=len(posts))