From 534b50446052c9b4203f11c713cb2bf92e9803a2 Mon Sep 17 00:00:00 2001 From: "Andreas (@xAndy) Zimmermann" Date: Sat, 13 May 2023 15:10:17 +0200 Subject: [PATCH] dont overwrite other bucket shifts during assignment --- shiftregister/fallback/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shiftregister/fallback/models.py b/shiftregister/fallback/models.py index 9c90613..2132bf9 100644 --- a/shiftregister/fallback/models.py +++ b/shiftregister/fallback/models.py @@ -51,7 +51,9 @@ class TeamMember(models.Model): ) # easy part: enough free shifts for everyone: shifts = free_bucket.order_by("?")[:shift_count] - self.fallback_shifts.set(shifts) + for shift in shifts: + self.fallback_shifts.add(shift) + # there is a chance that even if qota*teammembers team members are activatet, there are still unasigned shifts # this happens if there are shifts with multiple people left, as we can not assign multiple slots for # the same shift to one member.