Fix userpage hats owned display.
parent
b4ab5a2233
commit
8bb145d23c
|
@ -996,8 +996,6 @@ def u_username(username, v=None):
|
||||||
|
|
||||||
# this is probably totalllly inefficient but maybe someone can fix it later
|
# 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()
|
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 u.unban_utc:
|
||||||
if request.headers.get("Authorization") or request.path.endswith(".json"):
|
if request.headers.get("Authorization") or request.path.endswith(".json"):
|
||||||
|
@ -1013,12 +1011,8 @@ def u_username(username, v=None):
|
||||||
t=t,
|
t=t,
|
||||||
next_exists=next_exists,
|
next_exists=next_exists,
|
||||||
is_following=is_following,
|
is_following=is_following,
|
||||||
owned_hats=owned_hats,
|
|
||||||
owned_hats_pct=owned_hats_pct,
|
|
||||||
total_num_of_hats=total_num_of_hats)
|
total_num_of_hats=total_num_of_hats)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if request.headers.get("Authorization") or request.path.endswith(".json"):
|
if request.headers.get("Authorization") or request.path.endswith(".json"):
|
||||||
return {"data": [x.json for x in listing]}
|
return {"data": [x.json for x in listing]}
|
||||||
|
|
||||||
|
@ -1030,7 +1024,8 @@ def u_username(username, v=None):
|
||||||
sort=sort,
|
sort=sort,
|
||||||
t=t,
|
t=t,
|
||||||
next_exists=next_exists,
|
next_exists=next_exists,
|
||||||
is_following=is_following)
|
is_following=is_following,
|
||||||
|
total_num_of_hats=total_num_of_hats)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/@<username>/comments")
|
@app.get("/@<username>/comments")
|
||||||
|
|
|
@ -253,7 +253,7 @@
|
||||||
<p id="profile--info--spent">Coins spent: {{u.coins_spent}}</p>
|
<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--truescore">True score: {{u.truecoins}}</p>
|
||||||
<p id="profile--info--winnings">Winnings: {{u.winnings}}</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 %}
|
{% if u.is_private %}
|
||||||
<p id="profile--info--private">User has private mode enabled</p>
|
<p id="profile--info--private">User has private mode enabled</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -497,7 +497,7 @@
|
||||||
<p id="profile-mobile--info--spent">Coins spent: {{u.coins_spent}}</p>
|
<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--truescore">True score: {{u.truecoins}}</p>
|
||||||
<p id="profile-mobile--info--winnings">Winnings: {{u.winnings}}</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 %}
|
{% if u.is_private %}
|
||||||
<p id="profile-mobile--info--private">User has private mode enabled</p>
|
<p id="profile-mobile--info--private">User has private mode enabled</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in New Issue