Staffing Rules
Staff members are assigned to zones through a structured system that controls dispatch priority, temporal availability, and zone-scoped scheduling. This document covers the detailed rules governing how staff relate to zones and how the dispatch engine uses these relationships.
Staff-Zone Assignment Model
The core relationship between staff and zones is the staff-zone junction table. Each record links one staff member to one zone with several control properties.
Primary Zone
Each staff member should have exactly one zone assignment marked as primary at any given time. The primary zone is the staff member's "home zone" — the zone where they are dispatched first and where they spend most of their working time. All other zone assignments are secondary.
When a job comes in for a staff member's primary zone, that staff member is a top-priority candidate. For secondary zones, the staff member is only considered after all primary-zone staff are exhausted or unavailable.
Priority Numbers
Priority is a per-assignment number where lower values indicate higher dispatch preference. Priority values should be unique per staff member across all their zone assignments. A typical setup might look like: Downtown (primary, priority 1), Midtown (secondary, priority 2), Suburbs (secondary, priority 3).
When multiple staff members are candidates for the same zone, the dispatch engine sorts them by primary status first, then by priority number ascending. This creates a deterministic dispatch order that dispatchers can understand and predict.
Unique Constraints
The system enforces a unique constraint on the combination of staff member, zone, and effective-from date. This prevents duplicate assignments for the same staff-zone pair starting at the same time while still allowing the same pair to exist multiple times with different effective periods for seasonal re-assignments.
Temporal Assignments
Zone assignments support time-bounded periods through effective-from and effective-to dates. This enables several common staffing patterns.
Permanent assignments have an effective-from date of now and no effective-to date. This is the standard assignment for a staff member's home zone.
Seasonal coverage uses specific date ranges. For example, a staff member might be assigned to a beach zone from June 1 through September 30 to handle summer demand.
Vacation coverage is a temporary assignment to cover another staff member's primary zone while they are away. The covering staff member gets a time-bounded assignment to the absent person's zone.
Planned transfers use a future effective-from date. A staff member might be scheduled to transfer to a new zone starting next month, with the assignment already created but not yet active.
Only assignments where the effective-from date is in the past and the effective-to date is null or in the future are considered active for dispatching.
Dispatch Priority Matrix
The dispatch engine uses a strict priority matrix when selecting staff for a job in a specific zone.
First priority goes to primary zone staff who are available, sorted by priority number ascending. Second priority goes to additional primary zone staff at higher priority numbers. Third priority goes to secondary zone staff who are available, sorted by priority number ascending. If no staff are available through these three levels, the system escalates to the parent zone hierarchy if one exists, then to neighboring zones, and finally to the Pandora marketplace for broader availability.
Zone Reassignment
Changing a staff member's zone assignments follows a careful process to maintain data integrity. To change a primary zone from Zone A to Zone B, the system first sets the current primary assignment to non-primary. Then it checks if a Zone B assignment already exists — if so, it updates that assignment to primary; if not, it creates a new primary assignment. Finally, it re-sequences priority numbers to maintain unique, sequential ordering.
An audit log entry records the reassignment with before and after state for accountability.
Zone-Scoped Scheduling
Staff can have different schedules depending on which zone they are working in. A zone-scoped schedule assignment overrides the staff member's default schedule specifically for jobs in that zone. The default schedule only applies in zones where the staff member has no zone-specific assignment.
For example, a staff member might work 7:00 AM to 3:00 PM when assigned to Downtown jobs but 9:00 AM to 2:00 PM on weekends for Suburbs jobs. When a job comes in for Downtown on a weekday at 2:00 PM, the zone-scoped schedule confirms availability. When a Suburbs job comes in at 2:00 PM on a Tuesday, the zone-scoped schedule says unavailable (Suburbs schedule is weekends only), and the default schedule is not consulted.
Deactivation Rules
Deactivating or deleting a zone assignment does not affect historical job records where the staff member was dispatched via that zone, completed timesheets or payroll records, or schedule assignments scoped to that zone (they become orphaned but inactive). This preservation of history is essential for audit compliance and payroll accuracy.
On this page