Fix metrics again

pull/1/head
Luca 2 years ago
parent 28c23f5782
commit 422d588d53

@ -5,6 +5,10 @@ from django.db import models
def metrics(request):
worked_seconds_total = ShiftRegistration.objects.filter(
state=ShiftRegistration.RegState.CHECKED_IN
).aggregate(sum=Sum("shift__duration"))["sum"]
response = HttpResponse(
"\n".join(
(
@ -38,18 +42,16 @@ def metrics(request):
Message.objects.all().count(),
),
(
"worked_shifts_total",
ShiftRegistration.objects.filter(
state=ShiftRegistration.RegState.CHECKED_IN
).count(),
"worked_seconds_total",
worked_seconds_total.total_seconds()
if worked_seconds_total
else 0.0,
),
(
"worked_seconds_total",
"worked_shifts_total",
ShiftRegistration.objects.filter(
state=ShiftRegistration.RegState.CHECKED_IN
)
.aggregate(sum=Sum("shift__duration"))["sum"]
.total_seconds(),
).count(),
),
)
)

Loading…
Cancel
Save