diff --git a/engine/apps/api/tests/test_schedules.py b/engine/apps/api/tests/test_schedules.py index 6f766998..7e49a987 100644 --- a/engine/apps/api/tests/test_schedules.py +++ b/engine/apps/api/tests/test_schedules.py @@ -652,7 +652,7 @@ def test_filter_events_overrides( organization=organization, shift_type=CustomOnCallShift.TYPE_OVERRIDE, **override_data ) other_user = make_user_for_organization(organization) - override.users.add(other_user) + override.add_rolling_users([[other_user]]) url = reverse("api-internal:schedule-filter-events", kwargs={"pk": schedule.public_primary_key}) url += "?date={}&days=3&type=override".format(request_date.strftime("%Y-%m-%d")) @@ -744,7 +744,7 @@ def test_filter_events_final_schedule( override = make_on_call_shift( organization=organization, shift_type=CustomOnCallShift.TYPE_OVERRIDE, **override_data ) - override.users.add(user_e) + override.add_rolling_users([[user_e]]) url = reverse("api-internal:schedule-filter-events", kwargs={"pk": schedule.public_primary_key}) url += "?date={}&days=1".format(request_date.strftime("%Y-%m-%d")) diff --git a/engine/apps/schedules/models/custom_on_call_shift.py b/engine/apps/schedules/models/custom_on_call_shift.py index 64d72ae8..c19d2250 100644 --- a/engine/apps/schedules/models/custom_on_call_shift.py +++ b/engine/apps/schedules/models/custom_on_call_shift.py @@ -246,7 +246,7 @@ class CustomOnCallShift(models.Model): # use shift time_zone if it exists, otherwise use schedule or default time_zone time_zone = self.time_zone if self.time_zone is not None else time_zone # rolling_users shift converts to several ical events - if self.type == CustomOnCallShift.TYPE_ROLLING_USERS_EVENT: + if self.type in (CustomOnCallShift.TYPE_ROLLING_USERS_EVENT, CustomOnCallShift.TYPE_OVERRIDE): event_ical = None users_queue = self.get_rolling_users() for counter, users in enumerate(users_queue, start=1): diff --git a/engine/apps/schedules/tests/test_custom_on_call_shift.py b/engine/apps/schedules/tests/test_custom_on_call_shift.py index 1782e483..70ec55b0 100644 --- a/engine/apps/schedules/tests/test_custom_on_call_shift.py +++ b/engine/apps/schedules/tests/test_custom_on_call_shift.py @@ -48,7 +48,7 @@ def test_get_on_call_users_from_web_schedule_override(make_organization_and_user } on_call_shift = make_on_call_shift(organization=organization, shift_type=CustomOnCallShift.TYPE_OVERRIDE, **data) - on_call_shift.users.add(user) + on_call_shift.add_rolling_users([[user]]) # user is on-call date = date + timezone.timedelta(minutes=5)