remove player from participant list on own page

This commit is contained in:
Maximilian Keßler 2024-01-10 02:46:23 +01:00
parent c6c9ab8377
commit 01bdd9544e
Signed by: max
GPG key ID: BCC5A619923C0BA5
5 changed files with 7 additions and 6 deletions

View file

@ -262,6 +262,7 @@ def group_games_by_player(games: List[GameRow]):
row = dataclasses.asdict(game) row = dataclasses.asdict(game)
row["user_rating_change"] = round(game.user_rating_changes[i], 1) row["user_rating_change"] = round(game.user_rating_changes[i], 1)
row["user_rating_after"] = round(game.user_ratings_after[i], 1) row["user_rating_after"] = round(game.user_ratings_after[i], 1)
row["users"].remove(user)
ret[user].append(row) ret[user].append(row)
return ret return ret

View file

@ -188,7 +188,7 @@
<script> <script>
{% for rating_type in leaders %} {% for rating_type in leaders %}
{{ games_table_js("tabledata", rating_type, True, False, False) }} {{ games_table_js("tabledata", rating_type, True, False, False, "Players") }}
table_{{rating_type}}.setFilter("rating_type", "=", {{rating_type}}); table_{{rating_type}}.setFilter("rating_type", "=", {{rating_type}});
{% endfor %} {% endfor %}
</script> </script>

View file

@ -51,7 +51,7 @@
]; ];
{% for rating_type in player_stat.keys() %} {% for rating_type in player_stat.keys() %}
{{ games_table_js("tabledata", rating_type, True, False, True) }} {{ games_table_js("tabledata", rating_type, True, False, True, "Teammates") }}
// Filter table on corresponding rating type // Filter table on corresponding rating type
table_{{rating_type}}.setFilter("rating_type", "=", {{rating_type}}); table_{{rating_type}}.setFilter("rating_type", "=", {{rating_type}});
{% endfor %} {% endfor %}

View file

@ -65,7 +65,7 @@
{% endmacro %} {% endmacro %}
{% macro games_table_js(data, div_id, show_player_num, show_var_rating, show_user_rating) %} {% 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}}", { var table_{{div_id}} = new Tabulator("#table-{{div_id}}", {
maxHeight: 400, maxHeight: 400,
data: {{data}}, data: {{data}},
@ -91,7 +91,7 @@ var table_{{div_id}} = new Tabulator("#table-{{div_id}}", {
{title: "+/-", field: "user_rating_change"}, {title: "+/-", field: "user_rating_change"},
{title: "ELO After", field: "user_rating_after"}, {title: "ELO After", field: "user_rating_after"},
{% endif %} {% endif %}
{title: "Players", field: "users", formatter:function(cell, formatterParams, onRendered) { {title: "{{player_description}}", field: "users", formatter:function(cell, formatterParams, onRendered) {
let links = cell.getValue().map(player => `<a href="/player/${encodeURIComponent(player)}">${player}</a>`); let links = cell.getValue().map(player => `<a href="/player/${encodeURIComponent(player)}">${player}</a>`);
return links.join(", "); return links.join(", ");
}}, }},

View file

@ -78,10 +78,10 @@
]; ];
// Main table // Main table
{{ games_table_js("tabledata", "overview", True, False, False) }} {{ games_table_js("tabledata", "overview", True, False, False, "Players") }}
{% for num_players in variant_stats_by_player.keys() %} {% for num_players in variant_stats_by_player.keys() %}
{{ games_table_js("tabledata", num_players, False, True, False) }} {{ games_table_js("tabledata", num_players, False, True, False, "Players") }}
// Filter table on corresponding page to only display games with corresponding player number // Filter table on corresponding page to only display games with corresponding player number
table_{{num_players}}.setFilter("num_players", "=", {{num_players}}); table_{{num_players}}.setFilter("num_players", "=", {{num_players}});
{% endfor %} {% endfor %}