Calculate stats for last 7/14 days from manual as well

This commit is contained in:
Lukáš Kucharczyk 2025-03-17 08:30:57 +01:00
parent ddd75f22b0
commit 0b274b4403
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg

View File

@ -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(),