2
0
Fork 0

Compare commits

..

2 Commits

Author SHA1 Message Date
Luca c70965c46d fix(fallback): allow blank inputs for TeamMember comment field
continuous-integration/drone/push Build is passing Details
2024-05-21 17:40:01 +02:00
Luca e0f7320801 refactor(fallback): remove unused code 2024-05-21 17:39:31 +02:00
1 changed files with 1 additions and 4 deletions

View File

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