diff --git a/games/templates/view_game.html b/games/templates/view_game.html index c8fb77a..ed8054d 100644 --- a/games/templates/view_game.html +++ b/games/templates/view_game.html @@ -57,7 +57,7 @@

Sessions - ({{ sessions.count }}) + ({{ session_count }}) {% url 'start_game_session' game.id as add_session_link %} {% include 'components/button.html' with title="Start new session" text="New" link=add_session_link %} and Notes ({{ sessions_with_notes_count }}) diff --git a/games/views.py b/games/views.py index 3ec5bf6..d8f145e 100644 --- a/games/views.py +++ b/games/views.py @@ -170,7 +170,9 @@ def view_game(request, game_id=None): .order_by("year_released") ) - sessions = Session.objects.filter(purchase__edition__game=game) + sessions = Session.objects.prefetch_related("device").filter( + purchase__edition__game=game + ) session_count = sessions.count() playrange_start = sessions.earliest().timestamp_start.strftime("%b %Y")