From 2dcbc45d67382bfbf44c204111ae310ab652b80c Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sun, 14 Apr 2024 08:17:02 +1200 Subject: [PATCH] hot sort - more spicy pls (experiment) --- app/post/routes.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/post/routes.py b/app/post/routes.py index 2f62b4d8..f80ab8b3 100644 --- a/app/post/routes.py +++ b/app/post/routes.py @@ -305,15 +305,19 @@ def post_vote(post_id: int, vote_direction): post.up_votes += 1 # Make 'hot' sort more spicy by amplifying the effect of early upvotes if post.up_votes + post.down_votes <= 10: + post.score += 10 + elif post.up_votes + post.down_votes <= 30: post.score += 5 - elif post.up_votes + post.down_votes <= 100: + elif post.up_votes + post.down_votes <= 60: post.score += 2 else: post.score += 1 else: effect = -1 post.down_votes += 1 - if post.up_votes + post.down_votes <= 100: + if post.up_votes + post.down_votes <= 30: + post.score -= 5 + elif post.up_votes + post.down_votes <= 60: post.score -= 2 else: post.score -= 1