Fix team dashboard again

pull/1/head
Luca 2 years ago
parent d18b2d6d3d
commit bbbc2733b4

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

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

Loading…
Cancel
Save