Compare commits

..

No commits in common. 'c70965c46d8a0af47ae87118ed21ea5931799706' and 'f63f565ca62e4b503bc719b23fc0f4374ed05b67' have entirely different histories.

@ -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, blank=True, default="") comment = models.CharField(max_length=100, default="")
fallback_shifts = models.ManyToManyField(Shift, through="FallbackAssignment") fallback_shifts = models.ManyToManyField(Shift, through="FallbackAssignment")
def url(self): def url(self):
@ -72,6 +72,9 @@ 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()

Loading…
Cancel
Save