diff --git a/games/templates/stats.html b/games/templates/stats.html index c6977b9..0dbe718 100644 --- a/games/templates/stats.html +++ b/games/templates/stats.html @@ -63,6 +63,14 @@ {{ highest_session_average }} ({{ highest_session_average_game }}) + + First play + {{ first_play_name }} ({{ first_play_date }}) + + + Last play + {{ last_play_name }} ({{ last_play_date }}) +

Purchases

diff --git a/games/views.py b/games/views.py index 114e3e5..89ad61b 100644 --- a/games/views.py +++ b/games/views.py @@ -428,6 +428,18 @@ def stats(request, year: int = 0): .count() ) + first_play_name = "N/A" + first_play_date = "N/A" + last_play_name = "N/A" + last_play_date = "N/A" + if this_year_sessions: + first_session = this_year_sessions.earliest() + first_play_name = first_session.purchase.edition.name + first_play_date = first_session.timestamp_start.strftime("%x") + last_session = this_year_sessions.latest() + last_play_name = last_session.purchase.edition.name + last_play_date = last_session.timestamp_start.strftime("%x") + context = { "total_hours": format_duration( this_year_sessions.total_duration_unformatted(), "%2.0H" @@ -491,6 +503,10 @@ def stats(request, year: int = 0): if highest_session_average_game else 0, "highest_session_average_game": highest_session_average_game, + "first_play_name": first_play_name, + "first_play_date": first_play_date, + "last_play_name": last_play_name, + "last_play_date": last_play_date, "title": f"{year} Stats", }