2
0
Fork 0

Fix team dashboard again

This commit is contained in:
Luca 2023-05-19 13:54:33 +02:00
parent d18b2d6d3d
commit bbbc2733b4
2 changed files with 9 additions and 11 deletions

View File

@ -37,16 +37,14 @@ class Shift(models.Model):
def with_reg_count():
return Shift.objects.annotate(
reg_count=Count(
Case(
When(
shiftregistration__state__in=[
ShiftRegistration.RegState.REGISTERED,
ShiftRegistration.RegState.CHECKED_IN,
],
then=1,
),
output_field=models.IntegerField(),
)
"shiftregistration",
distinct=True,
filter=Q(
shiftregistration__state__in=(
ShiftRegistration.RegState.REGISTERED,
ShiftRegistration.RegState.CHECKED_IN,
)
),
)
)

View File

@ -70,7 +70,7 @@ def team_dashboard(request):
When(required_helpers=0, then=F("room__required_helpers")),
default=F("required_helpers"),
),
fallbackassignment_count=Count("fallbackassignment"),
fallbackassignment_count=Count("fallbackassignment", distinct=True),
)
.filter(
deleted=False,