dont use pay_account and charge_account in votes

master
Aevann 2023-07-01 00:49:10 +03:00
parent d4613c3308
commit 67fa522b82
1 changed files with 3 additions and 3 deletions

View File

@ -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:
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
g.db.add(target.author)
existing.vote_type = new
existing.coins = coin_value
g.db.add(existing)
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
g.db.add(target.author)
g.db.delete(existing)
@ -112,7 +112,7 @@ def vote_post_comment(target_id, new, v, cls, vote_cls):
existing.vote_type = new
g.db.add(existing)
elif new != 0:
target.author.pay_account('coins', coin_value)
target.author.coins += coin_value
target.author.truescore += coin_delta
g.db.add(target.author)