2023-12-10 19:47:07 +01:00
|
|
|
{% macro stats_list(stats, show_rating, show_streaks) %}
|
2023-12-05 17:28:55 +01:00
|
|
|
<!-- Table for statistics of a variant -->
|
|
|
|
<div class="history-bullets">
|
|
|
|
<ul class="stat-list">
|
|
|
|
<li>
|
|
|
|
<span class="stat-description">Rating:</span>
|
2023-12-05 18:17:06 +01:00
|
|
|
{% if show_rating %}
|
|
|
|
{{stats.rating}}
|
|
|
|
{% else %}
|
|
|
|
-
|
|
|
|
{% endif %}
|
2023-12-05 17:28:55 +01:00
|
|
|
</li>
|
2023-12-10 19:47:07 +01:00
|
|
|
{% if show_streaks %}
|
|
|
|
<li>
|
|
|
|
<span class="stat-description">Maximum Streak:</span>
|
|
|
|
{{stats.max_streak}}
|
|
|
|
</li>
|
|
|
|
{% endif %}
|
2023-12-05 17:28:55 +01:00
|
|
|
<li>
|
|
|
|
<span class="stat-description">Total Perfect Scores:</span>
|
|
|
|
{{stats.games_won}}
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class="stat-description">Total Bottom Deck Risk:</span>
|
|
|
|
{{stats.total_bdr}}
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class="stat-description">Total Crits Lost:</span>
|
|
|
|
{{stats.total_crits_lost}}
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class="stat-description">Total Turns Taken:</span>
|
|
|
|
{{stats.total_moves}}
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<ul class="stat-list">
|
|
|
|
<li>
|
|
|
|
<span class="stat-description">Total Games Played:</span>
|
|
|
|
{{stats.games_played}}
|
|
|
|
</li>
|
2023-12-10 19:47:07 +01:00
|
|
|
{% if show_streaks %}
|
|
|
|
<li>
|
|
|
|
<span class="stat-description">Current Streak:</span>
|
|
|
|
{{stats.current_streak}}
|
|
|
|
</li>
|
|
|
|
{% endif %}
|
2023-12-05 17:28:55 +01:00
|
|
|
<li>
|
|
|
|
<span class="stat-description">Winrate:</span>
|
|
|
|
{{stats.winrate}}%
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class="stat-description">Average Bottom Deck Risk:</span>
|
|
|
|
{{stats.average_bdr}}
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class="stat-description">Average Crits Lost:</span>
|
|
|
|
{{stats.average_crits_lost}}
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class="stat-description">Average Turns Taken:</span>
|
|
|
|
{{stats.average_moves}}
|
|
|
|
</li>
|
|
|
|
</ul>
|
2023-12-05 18:30:15 +01:00
|
|
|
</div>
|
2023-12-07 16:37:55 +01:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
|
|
|
|
{% macro games_table_js(data, div_id, show_player_num, show_var_rating) %}
|
|
|
|
var table_{{div_id}} = new Tabulator("#table-{{div_id}}", {
|
|
|
|
height: 400,
|
|
|
|
data: {{data}},
|
|
|
|
layout: "fitDataStretch",
|
|
|
|
columns: [
|
|
|
|
{title: "id", field: "league_id"},
|
|
|
|
{title: "Game", field: "game_id", formatter: "link", formatterParams:{
|
|
|
|
urlPrefix: "https://hanab.live/replay/",
|
|
|
|
target:"_blank"
|
|
|
|
}},
|
|
|
|
{% if show_player_num %}
|
|
|
|
{title: "# Players", field: "num_players"},
|
|
|
|
{% endif %}
|
|
|
|
{% if show_var_rating %}
|
|
|
|
{title: "Rating Change", field: "variant_rating_change"},
|
|
|
|
{title: "Rating After", field: "variant_rating_after"},
|
|
|
|
{% endif %}
|
2023-12-10 12:04:31 +01:00
|
|
|
{title: "Players", field: "users", formatter:function(cell, formatterParams, onRendered) {
|
2023-12-10 19:47:07 +01:00
|
|
|
let links = cell.getValue().map(player => `<a href="/player/${encodeURIComponent(player)}">${player}</a>`);
|
2023-12-10 12:04:31 +01:00
|
|
|
return links.join(", ");
|
|
|
|
}},
|
2023-12-07 16:37:55 +01:00
|
|
|
{title: "Seed", field: "seed", formatter: "link", formatterParams: {
|
|
|
|
urlPrefix: "https://hanab.live/seed/",
|
|
|
|
target:"_blank"
|
|
|
|
}},
|
|
|
|
{title: "Score", field: "score"},
|
|
|
|
{title: "BDR", field: "num_bdrs"},
|
|
|
|
{title: "Turns", field: "num_turns"},
|
|
|
|
{title: "Result", field: "game_outcomes"}
|
|
|
|
],
|
|
|
|
});
|
|
|
|
{% endmacro %}
|