forked from rDrama/rDrama
dont use pay_account and charge_account in votes
parent
d4613c3308
commit
67fa522b82
|
@ -97,14 +97,14 @@ def vote_post_comment(target_id, new, v, cls, vote_cls):
|
||||||
if existing and existing.vote_type == new: return "", 204
|
if existing and existing.vote_type == new: return "", 204
|
||||||
if existing:
|
if existing:
|
||||||
if existing.vote_type == 0 and new != 0:
|
if existing.vote_type == 0 and new != 0:
|
||||||
target.author.pay_account('coins', coin_value)
|
target.author.coins += coin_value
|
||||||
target.author.truescore += coin_delta
|
target.author.truescore += coin_delta
|
||||||
g.db.add(target.author)
|
g.db.add(target.author)
|
||||||
existing.vote_type = new
|
existing.vote_type = new
|
||||||
existing.coins = coin_value
|
existing.coins = coin_value
|
||||||
g.db.add(existing)
|
g.db.add(existing)
|
||||||
elif existing.vote_type != 0 and new == 0:
|
elif existing.vote_type != 0 and new == 0:
|
||||||
target.author.charge_account('coins', existing.coins, should_check_balance=False)
|
target.author.coins -= existing.coins
|
||||||
target.author.truescore -= coin_delta
|
target.author.truescore -= coin_delta
|
||||||
g.db.add(target.author)
|
g.db.add(target.author)
|
||||||
g.db.delete(existing)
|
g.db.delete(existing)
|
||||||
|
@ -112,7 +112,7 @@ def vote_post_comment(target_id, new, v, cls, vote_cls):
|
||||||
existing.vote_type = new
|
existing.vote_type = new
|
||||||
g.db.add(existing)
|
g.db.add(existing)
|
||||||
elif new != 0:
|
elif new != 0:
|
||||||
target.author.pay_account('coins', coin_value)
|
target.author.coins += coin_value
|
||||||
target.author.truescore += coin_delta
|
target.author.truescore += coin_delta
|
||||||
g.db.add(target.author)
|
g.db.add(target.author)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue