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.
initial
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 initial
to 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.
Boss:
When a schedule in the initial
state reaches its schedule.start - organization.shifts_assigned_days_before_start
time, Staffjoy automatically promotes it to mobius-queue
.
Flex:
Schedules will remain in this state until they are moved.
unpublished
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 havedemand
,min_shift_length_hour
, andmax_shift_length_hour
set. When the system claims a job, the schedule state is set tochomp-processing
. It will be returned tounpublished
once 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 tomobius-processing
. The schedule will automatically be set topublished
after 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.
published
When a schedule is transitioned to the published
state, shifts in the role are automatically promoted to published=true
if 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.