From d211326c3fe0501db3133db8503acbb3645eb65d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Sun, 12 Nov 2023 08:01:12 +0100 Subject: [PATCH] Make sure empty stats are 0 --- games/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/games/views.py b/games/views.py index 7acc8db..68247ee 100644 --- a/games/views.py +++ b/games/views.py @@ -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)