Fix userpage hats owned display.

remotes/1693176582716663532/tmp_refs/heads/watchparty
Snakes 2022-10-08 16:11:38 -04:00
parent b4ab5a2233
commit 8bb145d23c
Signed by: Snakes
GPG Key ID: E745A82778055C7E
2 changed files with 4 additions and 9 deletions

View File

@ -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("/@<username>/comments")

View File

@ -253,7 +253,7 @@
<p id="profile--info--spent">Coins spent: {{u.coins_spent}}</p>
<p id="profile--info--truescore">True score: {{u.truecoins}}</p>
<p id="profile--info--winnings">Winnings: {{u.winnings}}</p>
<p id="profile--info--hats-owned" {% if owned_hats == total_num_of_hats %}class="profile-owned-all-hats"{% endif %}>{{owned_hats}}/{{total_num_of_hats}} hats owned ({{owned_hats_pct}})</p>
<p id="profile--info--hats-owned" {% if u.num_of_owned_hats == total_num_of_hats %}class="profile-owned-all-hats"{% endif %}>{{u.num_of_owned_hats}} / {{total_num_of_hats}} hats owned ({{ '{:.0%}'.format(u.num_of_owned_hats / total_num_of_hats) }})</p>
{% if u.is_private %}
<p id="profile--info--private">User has private mode enabled</p>
{% endif %}
@ -497,7 +497,7 @@
<p id="profile-mobile--info--spent">Coins spent: {{u.coins_spent}}</p>
<p id="profile-mobile--info--truescore">True score: {{u.truecoins}}</p>
<p id="profile-mobile--info--winnings">Winnings: {{u.winnings}}</p>
<p id="profile-mobile--info--hats-owned" {% if owned_hats == total_num_of_hats %}class="profile-owned-all-hats"{% endif %}>{{owned_hats}}/{{total_num_of_hats}} hats owned ({{owned_hats_pct}})</p>
<p id="profile-mobile--info--hats-owned" {% if u.num_of_owned_hats == total_num_of_hats %}class="profile-owned-all-hats"{% endif %}>{{u.num_of_owned_hats}} / {{total_num_of_hats}} hats owned ({{ '{:.0%}'.format(u.num_of_owned_hats / total_num_of_hats) }})</p>
{% if u.is_private %}
<p id="profile-mobile--info--private">User has private mode enabled</p>
{% endif %}