diff --git a/app/routers/stats.py b/app/routers/stats.py index 6e087cf..62547ec 100644 --- a/app/routers/stats.py +++ b/app/routers/stats.py @@ -62,7 +62,6 @@ def stats_graph_api( # Add a fake final datapoint to the series for any decks that weren't played in the latest game, so that lines # continue all the way to the end of the graph latest_date_formatted = latest_date_so_far.strftime("%Y-%m-%d") - print(f"DEBUG = {latest_date_formatted=}") for games in data_grouped_by_deck.values(): if games[-1]["date"] != latest_date_formatted: games.append( diff --git a/app/static/css/graph.css b/app/static/css/graph.css index 627f740..51000c5 100644 --- a/app/static/css/graph.css +++ b/app/static/css/graph.css @@ -2,4 +2,12 @@ float: left; margin: 2px; background-color: lightblue; +} + +p.playerName { + cursor: pointer; +} + +p.all_checked { + font-weight: bold; } \ No newline at end of file diff --git a/app/static/js/stats/graph.js b/app/static/js/stats/graph.js index 553c33d..c9d7b31 100644 --- a/app/static/js/stats/graph.js +++ b/app/static/js/stats/graph.js @@ -15,6 +15,16 @@ function updateGraphWithFilter() { $(document).ready(function() { $('#filter_button').click(updateGraphWithFilter) + $('body').on('click', 'p.playerName', function() { + // Check or uncheck all checkboxes in that div + if ($(this).hasClass('all_checked')) { + $(this).parent().children('input[type=checkbox]').prop('checked', false); + $(this).removeClass('all_checked') + } else { + $(this).parent().children('input[type=checkbox]').prop('checked', true); + $(this).addClass('all_checked') + } + }) fetch('/api/deck/by_player') .then(response => response.json()) @@ -58,7 +68,7 @@ function buildPlayerDecksDiv(parentDiv, playerName, playerDecks) { div = $('
', id='player_div_for_' + playerName ) - div.append('

' + playerName + '

') + div.append('

' + playerName + '

') for (deck of playerDecks) { div.append('
') } diff --git a/app/templates/stats/graph.html b/app/templates/stats/graph.html index 53da789..63e9eb9 100644 --- a/app/templates/stats/graph.html +++ b/app/templates/stats/graph.html @@ -16,6 +16,7 @@

Filter

+

(Click a player name to check/uncheck all their decks)


{% endblock %} \ No newline at end of file