master
Aevann1 2022-01-02 20:03:51 +02:00
parent 9fe1d12b7c
commit edc7f951d1
3 changed files with 9 additions and 2 deletions

View File

@ -220,6 +220,13 @@ class User(Base):
if u not in alts: alts.append(u)
return alts
@property
@lazy
def alts_patron(self):
for u in self.alts_unique:
if u.patron: return True
return False
@property
@lazy
def strid(self):

View File

@ -218,7 +218,7 @@ def transfer_coins(v, username):
if v.coins < amount: return {"error": f"You don't have enough {app.config['COINS_NAME']}"}, 400
if amount < 100: return {"error": f"You have to gift at least 100 {app.config['COINS_NAME']}."}, 400
if not v.patron and not receiver.patron:
if not v.patron and not receiver.patron and not v.alts_patron and not receiver.alts_patron:
tax = math.ceil(amount*0.03)
tax_receiver = g.db.query(User).filter_by(id=TAX_RECEIVER_ID).one_or_none()
tax_receiver.coins += tax

View File

@ -691,7 +691,7 @@
{% endif %}
{% if v %}
<div id='tax' class="d-none">{% if v.patron or u.patron %}0{% else %}0.03{% endif %}</div>
<div id='tax' class="d-none">{% if v.patron or u.patron or v.alts_patron or u.alts_patron %}0{% else %}0.03{% endif %}</div>
<script src="/static/assets/js/userpage_v.js?a=5"></script>
<div id="username" class="d-none">{{u.username}}</div>
{% endif %}