Fix web oncall calendars not loading (#891)

* Fix oncall schedules bug

* Update custom_on_call_shift.py
This commit is contained in:
Ildar Iskhakov 2022-11-23 20:19:52 +08:00 committed by GitHub
parent bd275848dc
commit 2052faa8d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -373,6 +373,8 @@ class CustomOnCallShift(models.Model):
expected_start_day = min(CustomOnCallShift.ICAL_WEEKDAY_REVERSE_MAP[d] for d in self.by_day)
delta = (expected_start_day - start.weekday()) % 7
start = start + timezone.timedelta(days=delta)
if self.until is not None:
self.until = self.until + timezone.timedelta(days=delta)
if self.frequency == CustomOnCallShift.FREQUENCY_DAILY and self.by_day:
result = self._daily_by_day_to_ical(time_zone, start, users_queue)