Staffjoy uses a state machine to control the automation of shift creation, assignment, and publication. Changing the state of a schedule coordinates actions for all shifts that start during the schedule. Formally, this is defined by
schedule.start <= shift.start < schedule.stop.
For reference, "chomp" refers to our internal engineering service that computes shifts from demand, and "mobius" refers to our internal engineering service that assigns workers to shifts.
Schedules start in the
initial state. When a user begins planning schedules in the front-end, we transition the state to
unpublished. When the state transitions from
unpublished, recurring shifts are created for the given week. We wait until the last moment possible to do this so that modifications to recurring shifts are accounted for.
When a schedule in the
initial state reaches its
schedule.start - organization.shifts_assigned_days_before_start time, Staffjoy automatically promotes it to
Schedules will remain in this state until they are moved.
Shifts are constructed while the schedule is in the unpublished state. They can be created via the shifts api or by using Staffjoy's demand-based automated shift calculation.
There are 3 possible next states:
chomp-queue- Sends the schedule to Staffjoy's demand-based, automatic shift calculation service, Chomp. The schedule must have
max_shift_length_hourset. When the system claims a job, the schedule state is set to
chomp-processing. It will be returned to
unpublishedonce shifts are calculated.
mobius-queue(Boss only) - Sends the schedule to Staffjoy's shift assignment system, Mobius. When the system claims a job, the schedule state is set to
mobius-processing. The schedule will automatically be set to
publishedafter the calculation is complete.
published- Workers are not assigned to shifts, so this step typically happens only for Flex organizations when they click "Publish Now" in the UI.
Boss: If a schedule is not been manually promoted to
mobius-queue, it will be automatically transitioned once it reaches the time of
schedule.start - organization.shifts_assigned_days_before_start time. The schedule is always set to
published after calculation.
Flex: Schedules will remain in this state until they are moved.
When a schedule is transitioned to the
published state, shifts in the role are automatically promoted to
schedule.start <= shift.start < schedule.stop. All workers and admins receive an email notifying them that schedules are published. Workers may view and claim shifts in the My Schedules App.