Override shifts use rolling_users

This commit is contained in:
Matias Bordese 2022-07-22 11:54:53 -03:00
parent 4649f1faaa
commit cf6a43c71e
3 changed files with 4 additions and 4 deletions

View file

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

View file

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

View file

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