change sorting logic for WPD

remotes/1693045480750635534/spooky-22
Aevann1 2022-07-10 11:29:55 +02:00
parent 7ccd3a79b7
commit c214d4b7cc
2 changed files with 6 additions and 1 deletions

View File

@ -29,6 +29,8 @@ def sort_comments(sort, comments):
return comments.order_by((Comment.upvotes+1)/(Comment.downvotes+1) + (Comment.downvotes+1)/(Comment.upvotes+1), Comment.downvotes.desc(), Comment.id.desc())
elif sort == "bottom":
return comments.order_by(Comment.upvotes - Comment.downvotes)
elif SITE == 'watchpeopledie.co':
return comments.order_by(Comment.downvotes - Comment.upvotes, Comment.id.desc())
else:
return comments.order_by(Comment.realupvotes.desc(), Comment.id.desc())

View File

@ -119,7 +119,10 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
if sort in ("hot","warm"):
ti = int(time.time()) + 3600
posts = posts.order_by(-1000000*(Submission.realupvotes + 1 + Submission.comment_count/num)/(func.power(((ti - Submission.created_utc)/1000), 1.23)), Submission.created_utc.desc())
if SITE == 'watchpeopledie.co':
posts = posts.order_by(-1000000*(Submission.downvotes - Submission.upvotes + 1 + Submission.comment_count/num)/(func.power(((ti - Submission.created_utc)/1000), 1.23)), Submission.created_utc.desc())
else:
posts = posts.order_by(-1000000*(Submission.realupvotes + 1 + Submission.comment_count/num)/(func.power(((ti - Submission.created_utc)/1000), 1.23)), Submission.created_utc.desc())
elif sort == "bump":
posts = posts.filter(Submission.comment_count > 1).order_by(Submission.bump_utc.desc(), Submission.created_utc.desc())
else: