From 1eb0cdffac550f1eb0996e81311db16f25769331 Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 24 Jan 2023 12:05:16 +0200 Subject: [PATCH] add progstack to WPD too (fixed) --- files/helpers/sorting_and_time.py | 3 +-- files/routes/votes.py | 36 ++++++++++++++++--------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/files/helpers/sorting_and_time.py b/files/helpers/sorting_and_time.py index a1ccf259a..8bc5a993e 100644 --- a/files/helpers/sorting_and_time.py +++ b/files/helpers/sorting_and_time.py @@ -29,8 +29,7 @@ def sort_objects(sort, objects, cls, include_shadowbanned=False): if sort == 'hot': ti = int(time.time()) + 3600 - if SITE_NAME == 'rDrama': metric = cls.realupvotes - else: metric = cls.upvotes - cls.downvotes + metric = cls.realupvotes if cls.__name__ == "Submission": metric += cls.comment_count/5 return objects.order_by(-1000000*(metric + 1)/(func.power(((ti - cls.created_utc)/1000), 1.23)), cls.created_utc.desc()) elif sort == "bump" and cls.__name__ == "Submission": diff --git a/files/routes/votes.py b/files/routes/votes.py index 2e3007fb0..13be19078 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -161,26 +161,28 @@ def vote_post_comment(target_id, new, v, cls, vote_cls): if SITE_NAME == 'rDrama': target.realupvotes = get_vote_count(0, True) # first arg is ignored here + else: + target.realupvotes = target.upvotes - target.downvotes - mul = 1 - if target.is_approved == PROGSTACK_ID: - mul = PROGSTACK_MUL - else: - if target.author.progressivestack or (target.author.admin_level and target.author.id not in {AEVANN_ID, CARP_ID}): + mul = 1 + if target.is_approved == PROGSTACK_ID: + mul = PROGSTACK_MUL + elif SITE_NAME == 'rDrama': + if target.author.progressivestack or (target.author.admin_level and target.author.id not in {AEVANN_ID, CARP_ID}): + mul = 2 + if cls == Submission and target.author.id not in {8768,3402,5214,12719}: + if (target.domain.endswith('.win') or 'forum' in target.domain + or (target.domain in BOOSTED_SITES and not target.url.startswith('/')) + or target.sub in BOOSTED_HOLES): mul = 2 - if cls == Submission and target.author.id not in {8768,3402,5214,12719}: - if (target.domain.endswith('.win') or 'forum' in target.domain - or (target.domain in BOOSTED_SITES and not target.url.startswith('/')) - or target.sub in BOOSTED_HOLES): - mul = 2 - elif not target.sub and target.body_html: - x = target.body_html.count('" target="_blank" rel="nofollow noopener">') - x += target.body_html.count('') + x += target.body_html.count('