On-Call Optimizer shifts are defined by the day of the week, hour and minute at which they start (e.g. Mon 10:00) and therefore no shift can ever be longer than 7 calendar days. The following details describe at a high-level how On-Call Optimizer uses this configuration data to generate specific shifts with fully-defined start and end times.
Given a starting timestamp:
The basic procedure can be used directly with an arbitrary timestamp to find the starting time of the next shift in the schedule.
To find the starting time of the shift that will follow an existing shift in the schedule, the procedure must be executed with the starting timestamp set to 1 minute after the starting time of the shift to be followed - any end time for the existing shift should be ignored. See the example below for an illustration of why this is important.
All time and date calculations during the extension process must be performed with respect to the time zone of the schedule itself.
Daily
wildcard will match any timestamp.Weekdays
wildcard will match any timestamp, where the abbreviated name of the day of the week (e.g. %a strftime(3) component) in the time zone of the schedule is one of the Mon-Fri set.Weekends
wildcard will match any timestamp, where the abbreviated name of the day of the week (e.g. %a strftime(3) component) in the time zone of the schedule is one of Sat or Sun.For simplicity these examples do not display the time zone, which is not relevant but can be assumed to be UTC.
Assuming a shift configuration of Mon 10:00, Fri 17:00
, when executed for the week starting April 1st 2024, the next 4 returned shifts
would be:
2024-04-01 10:00
2024-04-05 10:00
2024-04-08 10:00
2024-04-12 10:00
This provides a schedule with a ~5-day shift covering the working week, and a ~2-day shift covering the weekend.
Assuming a shift configuration of Daily 10:00, Weekends 22:00
, when executed on April 4th 2024, the next 7 returned shifts
would be:
2024-04-04 10:00
2024-04-05 10:00
2024-04-06 10:00
2024-04-06 22:00
2024-04-07 10:00
2024-04-07 22:00
2024-04-08 10:00
This provides a schedule with 24-hour shifts during weekdays, but adds an additional “overnight” shift on weekends resulting in a split of each weekend day (Sat, Sun) into two 12-hour shifts.
This example explains why it is important to extend from 1 minute after the start of the final existing shift, rather than from the end of the existing shift.
Mon 10:00
Mon 1st Apr 2024 10:00 - Mon 8th Apr 2024 09:59
Mon 09:00
Mon 8th Apr 2024 09:00 - Mon 15th Apr 2024 08:59
Moving the expected start time back by 1 hour creates an ambiguous situation for the schedule, either the next shift needs to start 1 hour prior to the end of the existing last shift, or if the end of the last shift is strictly observed and extension begins from 10am on Monday the 8th, the next starting time is not until 9am the following Monday, creating a 7-day gap in the schedule!
While either scenario will likely require user input to resolve and confirm the desired intention, On-Call Optimizer prefers to generate schedules that provide continuous coverage and therefore adopts the rule describe above - extension starts from the minute after the last existing shift starts, resulting in shifts that overlap the existing schedule by returned.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.