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