2
0
Fork 0

Add metric 'helpers_registered'

This commit is contained in:
Luca 2023-05-08 18:49:50 +02:00
parent f2dbda15aa
commit aabbb372b5
1 changed files with 19 additions and 0 deletions

View File

@ -19,6 +19,25 @@ def metrics(request):
"helpers_confirmed_total",
Helper.objects.filter(number_validated=True).count(),
),
(
"helpers_registered",
Helper.objects.annotate(
shift_count=Count(
Case(
When(
shiftregistration__state__in=[
ShiftRegistration.RegState.REGISTERED,
ShiftRegistration.RegState.CHECKED_IN,
],
then=1,
),
output_field=models.IntegerField(),
)
)
)
.filter(number_validated=True, shift_count__gte=1)
.count(),
),
(
"helpers_helped_total",
Helper.objects.annotate(