diff --git a/files/routes/jinja2.py b/files/routes/jinja2.py index 61dec3172..260192779 100644 --- a/files/routes/jinja2.py +++ b/files/routes/jinja2.py @@ -101,6 +101,10 @@ def expand_art(url): if id < MIN_ART_ID_FOR_HQ: return url return f"{SITE_FULL_IMAGES}/asset_submissions/art/original/{id}.webp" +@app.template_filter("commas") +def commas(number): + return "{:,}".format(number) + def current_registered_users(): return "{:,}".format(g.db.query(User).count()) diff --git a/files/templates/admin/loggedin.html b/files/templates/admin/loggedin.html index 25e25f068..00859f60f 100644 --- a/files/templates/admin/loggedin.html +++ b/files/templates/admin/loggedin.html @@ -14,7 +14,7 @@ {{loop.index}} {% include "user_in_table.html" %} - {{"{:,}".format(user.truescore)}} + {{user.truescore|commas}} {% endfor %} diff --git a/files/templates/admins.html b/files/templates/admins.html index 65e403edb..aeed0e2c7 100644 --- a/files/templates/admins.html +++ b/files/templates/admins.html @@ -21,8 +21,8 @@ {{loop.index}} {% include "user_in_table.html" %} {{5 if user.id == CARP_ID else user.admin_level}} - {{"{:,}".format(user.truescore)}} - {{"{:,}".format(user.modaction_num)}} + {{user.truescore|commas}} + {{user.modaction_num|commas}} {% endfor %} diff --git a/files/templates/hats.html b/files/templates/hats.html index 03a9872e9..9ae3bdab4 100644 --- a/files/templates/hats.html +++ b/files/templates/hats.html @@ -26,11 +26,11 @@
  • Number of hats you bought: {{v.num_of_owned_hats}}
  • Number of hats you designed: {{v.num_of_designed_hats}}
  • Number of hats: {{num_of_hats}}
  • -
  • Currency you spent on hats: {{"{:,}".format(v.currency_spent_on_hats)}}
  • -
  • Total currency spent on hats: {{"{:,}".format(sales)}}
  • -
  • Your current coins: {{"{:,}".format(v.coins)}}
  • +
  • Currency you spent on hats: {{v.currency_spent_on_hats|commas}}
  • +
  • Total currency spent on hats: {{sales|commas}}
  • +
  • Your current coins: {{v.coins|commas}}
  • {% if FEATURES['MARSEYBUX'] %} -
  • Your current marseybux: {{"{:,}".format(v.marseybux)}}
  • +
  • Your current marseybux: {{v.marseybux|commas}}
  • {% endif %} diff --git a/files/templates/leaderboard.html b/files/templates/leaderboard.html index da02df985..560c48598 100644 --- a/files/templates/leaderboard.html +++ b/files/templates/leaderboard.html @@ -38,9 +38,9 @@ {{position_no}} {% include "user_in_table.html" %} {% if user_relative_url is not none %} - {{"{:,}".format(value)}} + {{value|commas}} {% else %} - {{"{:,}".format(value)}} + {{value|commas}} {% endif %} {% endmacro %} diff --git a/files/templates/poll_votes.html b/files/templates/poll_votes.html index 21fb6f91f..ee0da4a2e 100644 --- a/files/templates/poll_votes.html +++ b/files/templates/poll_votes.html @@ -8,7 +8,7 @@

    Link: {{option.parent.permalink}}

    Author: @{{option.parent.author_name}}

    Author Created At:

    -

    Author Truescore: {{"{:,}".format(option.parent.author.truescore)}}

    +

    Author Truescore: {{option.parent.author.truescore|commas}}

    Total voter truescore: {{total_ts}}

    {% if total_patrons != None %}

    Total {{patron}}s: {{total_patrons}} | ${{total_money}}

    @@ -33,7 +33,7 @@ {% include "user_in_table.html" %} {% endwith %} - {{"{:,}".format(vote.user.truescore)}} + {{vote.user.truescore|commas}} {% endfor %} diff --git a/files/templates/shop.html b/files/templates/shop.html index d9b66965a..406c00c5d 100644 --- a/files/templates/shop.html +++ b/files/templates/shop.html @@ -26,11 +26,11 @@
  • Number of lootboxes you bought: {{v.lootboxes_bought}}
  • {% endif %}
  • Number of awards you bought: {{v.num_of_bought_awards}}
  • -
  • Currency you spent on awards: {{"{:,}".format(v.currency_spent_on_awards)}}
  • -
  • Total currency spent on awards: {{"{:,}".format(sales)}}
  • -
  • Your current coins: {{"{:,}".format(v.coins)}}
  • +
  • Currency you spent on awards: {{v.currency_spent_on_awards|commas}}
  • +
  • Total currency spent on awards: {{sales|commas}}
  • +
  • Your current coins: {{v.coins|commas}}
  • {% if FEATURES['MARSEYBUX'] %} -
  • Your current marseybux: {{"{:,}".format(v.marseybux)}}
  • +
  • Your current marseybux: {{v.marseybux|commas}}
  • {% endif %}
  • Your total award discount: {{v.formatted_award_discount}}
  • diff --git a/files/templates/votes.html b/files/templates/votes.html index 629240fcb..9de812d67 100644 --- a/files/templates/votes.html +++ b/files/templates/votes.html @@ -6,7 +6,7 @@

    {{obj.permalink}}

    Author: @{{obj.author.username}}

    Author Created At:

    -

    Author Truescore: {{"{:,}".format(obj.author.truescore)}}

    +

    Author Truescore: {{obj.author.truescore|commas}}

    Upvotes: {{ups | length}}

    Downvotes: {{downs | length}}

    @@ -30,7 +30,7 @@ {% include "user_in_table.html" %} {% endwith %} - {{"{:,}".format(vote.user.truescore)}} + {{vote.user.truescore|commas}} 1599343262 %}data-time="{{vote.created_utc}}"{% endif %}> {% endfor %} @@ -57,7 +57,7 @@ {% include "user_in_table.html" %} {% endwith %} - {{"{:,}".format(vote.user.truescore)}} + {{vote.user.truescore|commas}} 1599343262 %}data-time="{{vote.created_utc}}"{% endif %}> {% endfor %}