|
|
@ -20,7 +20,7 @@ def generate_id():
|
|
|
|
class TeamMember(models.Model):
|
|
|
|
class TeamMember(models.Model):
|
|
|
|
id = models.IntegerField(default=generate_id, editable=False, primary_key=True)
|
|
|
|
id = models.IntegerField(default=generate_id, editable=False, primary_key=True)
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
comment = models.CharField(max_length=100, default="")
|
|
|
|
comment = models.CharField(max_length=100, blank=True, default="")
|
|
|
|
fallback_shifts = models.ManyToManyField(Shift, through="FallbackAssignment")
|
|
|
|
fallback_shifts = models.ManyToManyField(Shift, through="FallbackAssignment")
|
|
|
|
|
|
|
|
|
|
|
|
def url(self):
|
|
|
|
def url(self):
|
|
|
@ -72,9 +72,6 @@ class TeamMember(models.Model):
|
|
|
|
free_bucket = bucket.filter(fallback_count__lt=F("real_required_helpers"))
|
|
|
|
free_bucket = bucket.filter(fallback_count__lt=F("real_required_helpers"))
|
|
|
|
|
|
|
|
|
|
|
|
total_slot_count = bucket.aggregate(sum=Sum("real_required_helpers"))["sum"]
|
|
|
|
total_slot_count = bucket.aggregate(sum=Sum("real_required_helpers"))["sum"]
|
|
|
|
free_slot_count = free_bucket.annotate(
|
|
|
|
|
|
|
|
needed_helpers=F("real_required_helpers") - F("fallback_count")
|
|
|
|
|
|
|
|
).aggregate(sum=Sum("needed_helpers"))["sum"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
quota = global_preferences["helper__fallback_quota"]
|
|
|
|
quota = global_preferences["helper__fallback_quota"]
|
|
|
|
number_of_team_members = TeamMember.objects.count()
|
|
|
|
number_of_team_members = TeamMember.objects.count()
|
|
|
|