@ -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",
distinct=True,
filter=Q(
shiftregistration__state__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")),
default=F("required_helpers"),
fallbackassignment_count=Count("fallbackassignment"),
fallbackassignment_count=Count("fallbackassignment", distinct=True),
.filter(
deleted=False,