diff --git a/CHANGELOG.md b/CHANGELOG.md index 745a091..cd4914f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ * Finished (count) * Unfinished (count) * Refunded (count) + * Backlog Decrease (count) ### Improved * game overview: simplify playtime range display diff --git a/games/templates/stats.html b/games/templates/stats.html index 37ddb04..d44acf2 100644 --- a/games/templates/stats.html +++ b/games/templates/stats.html @@ -64,6 +64,10 @@ Unfinished {{ purchased_unfinished.count }} ({{ unfinished_purchases_percent }}%) + + Backlog Decrease + {{ backlog_decrease_count }} + Spendings ({{ total_spent_currency }}) {{ total_spent }} ({{ spent_per_game }}/game) diff --git a/games/views.py b/games/views.py index d2e486e..2de3751 100644 --- a/games/views.py +++ b/games/views.py @@ -356,6 +356,12 @@ def stats(request, year: int = 0): for item in total_playtime_per_platform: item["formatted_playtime"] = format_duration(item["total_playtime"], "%2.0H") + backlog_decrease_count = ( + Purchase.objects.filter(date_purchased__year__lt=year) + .filter(date_finished__year=year) + .count() + ) + context = { "total_hours": format_duration( year_sessions.total_duration_unformatted(), "%2.0H" @@ -390,6 +396,7 @@ def stats(request, year: int = 0): ), "all_purchased_refunded_this_year": all_purchased_refunded_this_year, "all_purchased_this_year": all_purchased_this_year, + "backlog_decrease_count": backlog_decrease_count, } request.session["return_path"] = request.path