From a851b5329a13f849416e6866590c72e07b1d67c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Mon, 16 Jan 2023 17:24:34 +0100 Subject: [PATCH] Correctly display game that is used as filter --- CHANGELOG.md | 5 +++++ src/web/tracker/templates/list_sessions.html | 4 ++-- src/web/tracker/views.py | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6818fc..62dbb94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## Unreleased + +* Fixed + * When filtering by game, the "Filtering by (...)" text would erroneously list an unrelated platform + ## 0.2.3 / 2023-01-15 23:13+01:00 * Allow filtering by platform and game on session list (https://git.kucharczyk.xyz/lukas/timetracker/issues/32) diff --git a/src/web/tracker/templates/list_sessions.html b/src/web/tracker/templates/list_sessions.html index a5ca87c..9c225ec 100644 --- a/src/web/tracker/templates/list_sessions.html +++ b/src/web/tracker/templates/list_sessions.html @@ -10,11 +10,11 @@ {% if dataset.count >= 1 %}
Total playtime: {{ total_duration }} over {{ dataset.count }} sessions.
{% endif %} - {% if purchase or platform %} + {% if purchase or platform or game %} - Filtering by "{% firstof purchase platform %}" + Filtering by "{% firstof purchase platform game %}" {% if purchase %}See all platforms{% endif %} {% endif %} {% if dataset.count >= 1 %} diff --git a/src/web/tracker/views.py b/src/web/tracker/views.py index 0675dc9..ddf85f1 100644 --- a/src/web/tracker/views.py +++ b/src/web/tracker/views.py @@ -63,7 +63,7 @@ def list_sessions(request, filter="", purchase_id="", platform_id="", game_id="" context["platform"] = Platform.objects.get(id=platform_id) elif filter == "game": dataset = Session.objects.filter(purchase__game=game_id) - context["game"] = Platform.objects.get(id=game_id) + context["game"] = Game.objects.get(id=game_id) else: dataset = Session.objects.all().order_by("-timestamp_start")