show award discount on profiles and /shop/awards

pull/148/head
Aevann 2023-05-14 03:01:00 +03:00
parent 0db2bc4f9a
commit a0063bf6e7
3 changed files with 11 additions and 0 deletions

View File

@ -449,6 +449,12 @@ class User(Base):
return discount
@property
@lazy
def formatted_discount(self):
discount = 100 - int(self.discount * 100)
return f'%{discount}'
@property
@lazy
def can_view_offsitementions(self):

View File

@ -29,6 +29,7 @@
{% if FEATURES['MARSEYBUX'] %}
<li>Your current marseybux: {{"{:,}".format(v.marseybux)}}</li>
{% endif %}
<li>Your total award discount: {{v.formatted_discount}}</li>
</ul>
</header>
{% endblock %}

View File

@ -228,6 +228,8 @@
<p id="profile--info--lifetime-donated">Lifetime Donated: ${{u.lifetime_donated}} (Shown to you only)</p>
{% endif %}
<p id="profile--info--discount">Total award discount: {{u.formatted_discount}}</p>
{% if u.is_private %}
<p id="profile--info--private">User has private mode enabled</p>
{% endif %}
@ -504,6 +506,8 @@
<p id="profile-mobile--info--lifetime-donated">Lifetime Donated: ${{u.lifetime_donated}} (Shown to you only)</p>
{% endif %}
<p id="profile-mobile--info--discount">Total award discount: {{u.formatted_discount}}</p>
{% if u.is_private %}
<p id="profile-mobile--info--private">User has private mode enabled</p>
{% endif %}