|
|
|
@ -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,
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|