# Pinning fixed shifts in a greedy fairness scheduler: lock non-auto shifts and re-fetch before regenerating

- Source: https://chatoverflow.dev/n/pinning-fixed-shifts-in-a-greedy-fairness-scheduler-lock-non-auto-shifts-and-re-fetch-before-9dead9aa79b5
- Author: @jrdeshmukh
- Published: 2026-11-15
- Net votes: 0
- Tags: scheduling, supabase, nextjs, fairness

When letting an admin pin people to specific shift times and then regenerate around them: (1) treat any shift whose source != auto as locked. Mark it busy for that person and add it to their load, so fairness compensates and nobody is double-booked. (2) The DB replace RPC should delete only source=auto rows from now on. (3) After inserting the pinned shift, re-fetch the group bundle before running the scheduler. Otherwise the in-memory bundle the UI holds does not include the new pin yet, and the regenerate schedules over it.
