forked from Hanabi/hanabi-league
140 lines
5.2 KiB
HTML
140 lines
5.2 KiB
HTML
{% macro stats_list(stats, single_rating, show_streaks, rating_description) %}
|
|
<!-- Table for statistics of a variant -->
|
|
<div class="history-bullets">
|
|
<ul class="stat-list">
|
|
<li>
|
|
<span class="stat-description">Rating{% if not single_rating %} {{ rating_description }}{% endif %}:</span>
|
|
{% if single_rating %}
|
|
{{stats.rating}}
|
|
{% else %}
|
|
{{ stats.rating|join(", ")}}
|
|
{% endif %}
|
|
</li>
|
|
{% if show_streaks %}
|
|
<li>
|
|
<span class="stat-description">Maximum Streak:</span>
|
|
{{stats.max_streak}}
|
|
</li>
|
|
{% endif %}
|
|
<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>
|
|
{% if show_streaks %}
|
|
<li>
|
|
<span class="stat-description">Current Streak:</span>
|
|
{{stats.current_streak}}
|
|
</li>
|
|
{% endif %}
|
|
<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>
|
|
</div>
|
|
{% endmacro %}
|
|
|
|
|
|
{% macro games_table_js(data, div_id, show_player_num, show_var_rating, show_user_rating, player_description) %}
|
|
var table_{{div_id}} = new Tabulator("#table-{{div_id}}", {
|
|
maxHeight: 400,
|
|
data: {{data}},
|
|
layout: "fitDataStretch",
|
|
columns: [
|
|
{title: "Game", field: "game_id", formatter: "link", formatterParams:{
|
|
urlPrefix: "https://hanab.live/replay/",
|
|
target:"_blank"
|
|
}},
|
|
{title: "Played", field: "datetime_finished", formatter: "datetime", formatterParams:{
|
|
inputFormat: "iso",
|
|
timezone: "system",
|
|
outputFormat: "dd/MM HH:mm"
|
|
}},
|
|
{% if show_player_num %}
|
|
{title: "#P", field: "num_players"},
|
|
{% endif %}
|
|
{% if show_var_rating %}
|
|
{title: "+/-", field: "variant_rating_change"},
|
|
{title: "ELO After", field: "variant_rating_after"},
|
|
{% endif %}
|
|
{% if show_user_rating %}
|
|
{title: "+/-", field: "user_rating_change"},
|
|
{title: "ELO After", field: "user_rating_after"},
|
|
{% endif %}
|
|
{title: "{{player_description}}", field: "users", formatter:function(cell, formatterParams, onRendered) {
|
|
let links = cell.getValue().map(player => `<a href="/player/${encodeURIComponent(player)}">${player}</a>`);
|
|
return links.join(", ");
|
|
}},
|
|
{title: "Seed", field: "seed", formatter: "link", formatterParams: {
|
|
urlPrefix: "https://hanab.live/seed/",
|
|
target:"_blank"
|
|
}},
|
|
{title: "SCR", field: "score"},
|
|
{title: "BDR", field: "num_bdrs"},
|
|
{title: "Turns", field: "num_turns"},
|
|
{title: "Result", field: "game_outcomes"}
|
|
],
|
|
});
|
|
{% endmacro %}
|
|
|
|
|
|
{% macro player_table_js(data, div_id) %}
|
|
var table_{{div_id}} = new Tabulator("#table-{{div_id}}", {
|
|
data: {{data}},
|
|
layout: "fitDataTable",
|
|
initialSort: [
|
|
{column: "name", dir: "asc"},
|
|
],
|
|
columns: [
|
|
{title: "Player", field: "name", formatter: "link", formatterParams:{
|
|
urlPrefix: "/player/",
|
|
}},
|
|
{title: "No Variant", headerHozAlign: "center", columns: [
|
|
{title: "ELO", field: "novar_rating", headerSortStartingDir: "desc"},
|
|
{title: "Games", field: "novar_games_played", headerSortStartingDir: "desc"},
|
|
{title: "Win%", field: "novar_winrate", headerSortStartingDir: "desc", formatter:function(cell, formatterParams, onRendered) {
|
|
return cell.getValue() + "%";
|
|
}},
|
|
{title: "Max Streak", field: "novar_max_streak", headerSortStartingDir: "desc"},
|
|
]},
|
|
{title: "Clue Starved", headerHozAlign: "center", columns: [
|
|
{title: "ELO", field: "cs_rating", headerSortStartingDir: "desc"},
|
|
{title: "Games", field: "cs_games_played", headerSortStartingDir: "desc"},
|
|
{title: "Win%", field: "cs_winrate", headerSortStartingDir: "desc", formatter:function(cell, formatterParams, onRendered) {
|
|
return cell.getValue() + "%";
|
|
}},
|
|
{title: "Max Streak", field: "cs_max_streak", headerSortStartingDir: "desc"}
|
|
]},
|
|
]
|
|
});
|
|
{% endmacro %}
|