From a0063bf6e7675a76ef2fce1d9acfb2263995a863 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sun, 14 May 2023 03:01:00 +0300 Subject: [PATCH] show award discount on profiles and /shop/awards --- files/classes/user.py | 6 ++++++ files/templates/shop.html | 1 + files/templates/userpage/banner.html | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/files/classes/user.py b/files/classes/user.py index cbe6e916f..caac6bb3a 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -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): diff --git a/files/templates/shop.html b/files/templates/shop.html index 496abed73..91add8290 100644 --- a/files/templates/shop.html +++ b/files/templates/shop.html @@ -29,6 +29,7 @@ {% if FEATURES['MARSEYBUX'] %}
  • Your current marseybux: {{"{:,}".format(v.marseybux)}}
  • {% endif %} +
  • Your total award discount: {{v.formatted_discount}}
  • {% endblock %} diff --git a/files/templates/userpage/banner.html b/files/templates/userpage/banner.html index 838f5000a..ba14995c5 100644 --- a/files/templates/userpage/banner.html +++ b/files/templates/userpage/banner.html @@ -228,6 +228,8 @@

    Lifetime Donated: ${{u.lifetime_donated}} (Shown to you only)

    {% endif %} +

    Total award discount: {{u.formatted_discount}}

    + {% if u.is_private %}

    User has private mode enabled

    {% endif %} @@ -504,6 +506,8 @@

    Lifetime Donated: ${{u.lifetime_donated}} (Shown to you only)

    {% endif %} +

    Total award discount: {{u.formatted_discount}}

    + {% if u.is_private %}

    User has private mode enabled

    {% endif %}