diff --git a/files/routes/users.py b/files/routes/users.py index 3ee41a2b9..b3cef624d 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -996,8 +996,6 @@ def u_username(username, v=None): # this is probably totalllly inefficient but maybe someone can fix it later total_num_of_hats = g.db.query(HatDef).filter(HatDef.submitter_id == None).count() - owned_hats = u.num_of_owned_hats - owned_hats_pct = f'{float(owned_hats) / total_num_of_hats:.0%}' if u.unban_utc: if request.headers.get("Authorization") or request.path.endswith(".json"): @@ -1013,12 +1011,8 @@ def u_username(username, v=None): t=t, next_exists=next_exists, is_following=is_following, - owned_hats=owned_hats, - owned_hats_pct=owned_hats_pct, total_num_of_hats=total_num_of_hats) - - if request.headers.get("Authorization") or request.path.endswith(".json"): return {"data": [x.json for x in listing]} @@ -1030,7 +1024,8 @@ def u_username(username, v=None): sort=sort, t=t, next_exists=next_exists, - is_following=is_following) + is_following=is_following, + total_num_of_hats=total_num_of_hats) @app.get("/@/comments") diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 5c79260b7..6875fe6cf 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -253,7 +253,7 @@

Coins spent: {{u.coins_spent}}

True score: {{u.truecoins}}

Winnings: {{u.winnings}}

-

{{owned_hats}}/{{total_num_of_hats}} hats owned ({{owned_hats_pct}})

+

{{u.num_of_owned_hats}} / {{total_num_of_hats}} hats owned ({{ '{:.0%}'.format(u.num_of_owned_hats / total_num_of_hats) }})

{% if u.is_private %}

User has private mode enabled

{% endif %} @@ -497,7 +497,7 @@

Coins spent: {{u.coins_spent}}

True score: {{u.truecoins}}

Winnings: {{u.winnings}}

-

{{owned_hats}}/{{total_num_of_hats}} hats owned ({{owned_hats_pct}})

+

{{u.num_of_owned_hats}} / {{total_num_of_hats}} hats owned ({{ '{:.0%}'.format(u.num_of_owned_hats / total_num_of_hats) }})

{% if u.is_private %}

User has private mode enabled

{% endif %}