From 0b274b4403ca384a5ef972b906cd44afc96b060b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Mon, 17 Mar 2025 08:30:57 +0100 Subject: [PATCH] Calculate stats for last 7/14 days from manual as well --- games/views/general.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/games/views/general.py b/games/views/general.py index c607680..a8feff7 100644 --- a/games/views/general.py +++ b/games/views/general.py @@ -22,10 +22,10 @@ def model_counts(request: HttpRequest) -> dict[str, bool]: timestamp_start__day=this_day, timestamp_start__month=this_month, timestamp_start__year=this_year, - ).aggregate(time=Sum(F("duration_calculated")))["time"] + ).aggregate(time=Sum(F("duration_calculated") + F("duration_manual")))["time"] last_7_played = Session.objects.filter( timestamp_start__gte=(now - timedelta(days=7)) - ).aggregate(time=Sum(F("duration_calculated")))["time"] + ).aggregate(time=Sum(F("duration_calculated") + F("duration_manual")))["time"] return { "game_available": Game.objects.exists(),