|
|
@ -84,9 +84,10 @@ class TeamMember(models.Model):
|
|
|
|
distinct=True,
|
|
|
|
distinct=True,
|
|
|
|
filter=Q(fallback_shifts__id__in=canidate_shift_ids),
|
|
|
|
filter=Q(fallback_shifts__id__in=canidate_shift_ids),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
overall_fallback_count=Count("fallback_shifts"),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.exclude(pk=self.pk)
|
|
|
|
.exclude(pk=self.pk)
|
|
|
|
.order_by("-relevant_fallback_count", "?")
|
|
|
|
.order_by("-relevant_fallback_count", "-overall_fallback_count", "?")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
assignment = False
|
|
|
|
assignment = False
|
|
|
|
for member in sorted_members:
|
|
|
|
for member in sorted_members:
|
|
|
|