Make sure empty stats are 0

This commit is contained in:
Lukáš Kucharczyk 2023-11-12 08:01:12 +01:00
parent 200819ceb0
commit f0822ff221
1 changed files with 1 additions and 1 deletions

View File

@ -336,7 +336,7 @@ def stats(request, year: int = 0):
this_year_spendings = this_year_purchases_without_refunded.aggregate(
total_spent=Sum(F("price"))
)
total_spent = this_year_spendings["total_spent"]
total_spent = this_year_spendings["total_spent"] or 0
games_with_playtime = (
Game.objects.filter(edition__purchase__session__in=this_year_sessions)