forked from MarseyWorld/MarseyWorld
parent
7e47c0b9cc
commit
0a42bde52b
|
@ -29,11 +29,10 @@ def sort_objects(sort, objects, cls, include_shadowbanned=False):
|
|||
|
||||
if sort == 'hot':
|
||||
ti = int(time.time()) + 3600
|
||||
|
||||
if cls.__name__ == "Submission":
|
||||
cls.realupvotes += cls.comment_count/5
|
||||
|
||||
return objects.order_by(-1000000*(cls.realupvotes + 1)/(func.power(((ti - cls.created_utc)/1000), 1.23)), cls.created_utc.desc())
|
||||
if SITE_NAME == 'rDrama': metric = cls.realupvotes
|
||||
else: metric = cls.upvotes - cls.downvotes
|
||||
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":
|
||||
return objects.filter(cls.comment_count > 1).order_by(cls.bump_utc.desc(), cls.created_utc.desc())
|
||||
elif sort == "comments" and cls.__name__ == "Submission":
|
||||
|
|
|
@ -161,28 +161,26 @@ 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
|
||||
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 = 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 = 2
|
||||
elif not target.sub and target.body_html:
|
||||
x = target.body_html.count('" target="_blank" rel="nofollow noopener">')
|
||||
x += target.body_html.count('<a href="/images/')
|
||||
target.realupvotes += min(x*2, 20)
|
||||
mul = 1 + x/10
|
||||
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('<a href="/images/')
|
||||
target.realupvotes += min(x*2, 20)
|
||||
mul = 1 + x/10
|
||||
|
||||
mul = min(mul, 2)
|
||||
target.realupvotes = floor(target.realupvotes * mul)
|
||||
mul = min(mul, 2)
|
||||
target.realupvotes = floor(target.realupvotes * mul)
|
||||
|
||||
g.db.add(target)
|
||||
return "", 204
|
||||
|
|
Loading…
Reference in New Issue