This is a bug. We'll look into it and get it fixed for the next bug fix release.
For now, we can avoid the issue in your model if you add this line of code to the Off Schedule down behavior's Down Function before the call to shiftscheduledownfunction().
downobject.stats.state("Availability").valueString = "Acquired";The reason this is happening is the interaction of two different things. First, the time table has the staff set to be Off Schedule from 2 to midnight and then from midnight to 6 as two separate events. So right at midnight the time table releases the staff and then reacquires the staff again for the second set of time. Second, the Staff Resource has a feature where if you try to acquire a specific person, but they are Unavailable (i.e. Off Schedule) then the staff request will be rerouted to the group where that person was last pulled from, or, if you acquired the person directly, from the person's first group. So when the second OffSchedule shift happens at midnight the time table tries to acquire the staff, but this happens right before the time table releases the staff the first time. Since the time table hasn't released the staff yet they are Unavailable and so the request gets rerouted to the Staff group. The workaround changes the staff's Availability state so that they aren't Unavailable when the time table tries to acquire them again and so the request isn't rerouted.
Thanks for pointing this out and sorry for any inconvenience!
Matthew Gillespie
FlexSim Software Developer