MarseyWorld/files/templates/special/worldcup22_leaderboard.html

36 lines
1.1 KiB
HTML

{%- extends 'default.html' -%}
{% block pagetitle %}World Cup 2022 Betting Leaderboard{% endblock %}
{% block content %}
<h1>World Cup 2022 Betting Leaderboard</h1>
<div class="overflow-x-auto">
<table class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>
<th onclick="sort_table(0)">#</th>
<th onclick="sort_table(1)">Name</th>
<th onclick="sort_table(2)">Wins</th>
<th onclick="sort_table(3)">Bets</th>
<th onclick="sort_table(4)">Win rate</th>
<th onclick="sort_table(5)">Winnings</th>
</tr>
</thead>
<tbody>
{% for r in result %}
<tr>
{% set user = users.get(r[0]) %}
<td>{{loop.index}}</td>
<td data-sort-key="{{user.username.lower() if user else ''}}">{%- include 'user_in_table.html' -%}</td>
<td>{{r[1]}}</td>
<td>{{r[2]}}</td>
{% set ratio = r[1]/r[2] %}
{% set percent = (ratio*100)|string %}
<td data-sort-key="{{ratio}}">{{percent[:3].replace('0.0', '0').rstrip('.')}}%</td>
<td>{{r[3]}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<script defer src="{{'js/sort_table.js' | asset}}"></script>
{% endblock %}