remotes/1693045480750635534/spooky-22
fireworks88 2021-07-30 20:40:15 +02:00
parent 18af5c4798
commit c61beac8c3
2 changed files with 24 additions and 5 deletions

View File

@ -295,6 +295,21 @@ class User(Base, Stndrd, Age_times):
return f"Unban in {text}"
@property
@lazy
def display_awards(self):
_awards = {}
for a in self.awards:
if a.kind in _awards:
_awards[a.kind]['count'] += 1
else:
_awards[a.kind] = a.type
_awards[a.kind]['count'] = 1
return list(_awards.values())
@property
@lazy
def post_notifications_count(self):

View File

@ -7,8 +7,7 @@
<th style="font-weight:bold;">#</th>
<th style="font-weight:bold;">Name</th>
<th style="font-weight:bold;">Tier</th>
<th style="font-weight:bold;">Shit awards</th>
<th style="font-weight:bold;">Ban awards</th>
<th style="font-weight:bold;">Awards</th>
</tr>
</thead>
{% for user in users %}
@ -18,9 +17,14 @@
<td><img style="width: 32px; height: 32px" src="/assets/images/badges/patron-{{user.patron}}.gif"></td>
<td style="font-weight:bold;">{% if user.shitawards %}{{user.shitawards}}{% endif %}</td>
<td style="font-weight:bold;">{% if user.banawards %}{{user.banawards}}{% endif %}</td>
<td style="font-weight:bold;">
{% for a in user.display_awards %}
<span class="d-inline-block mx-2">
<i class="{{ a['icon'] }} {{ a['color'] }}" data-toggle="tooltip" data-placement="bottom" title="{{ a['title'] }} Awards owned"></i>
{{ a['count'] }}
</span>
{% endfor %}
</td>
</tr>
{% endfor %}
</table>