wages/backend
jtricerolph c09b31c41e Migrate rota sync from /api/v2/schedules to /api/v2/rosters/on/{date}
The schedules list endpoint has two confirmed problems: it silently
drops all shift data for deactivated/terminated employees (even for
historical dates while they were still active), and it never returns
real oncost figures (cost_with_oncosts always equals cost). Both
verified against the live API. The roster endpoint (a different data
path — Roster is the weekly container, Schedule is an individual shift
within it) has neither problem: leavers' historical shifts are intact,
and real cost_with_oncosts + an oncosts_breakdown are present.

syncScheduled() now fetches one whole Mon-Sun roster per distinct week
overlapping the requested range (rosters/on/{date} returns the entire
week regardless of which date you ask for), flattens the nested
day->shifts structure, and filters back down to the requested range.
Explicitly paginated (page_size=100, following meta.total_pages)
rather than relying on the undocumented behaviour that omitting
page/page_size returns everything unpaginated.

Validated on dev before deploying: re-synced the 27/06-24/07 window
and confirmed a known leaver's shifts reappeared, real oncosts are now
present (Chef: £11,898 base vs £13,572 with oncosts), and forward/
draft-shift handling still works correctly for the 14-day rolling
sync. The Chef "overspend" the AI insight flagged turned out to be
entirely this artifact — corrected comparison shows a small underspend.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-25 10:01:35 +00:00
..
src Migrate rota sync from /api/v2/schedules to /api/v2/rosters/on/{date} 2026-07-25 10:01:35 +00:00
Dockerfile Initial scaffold: wages app 2026-07-23 09:03:52 +00:00
package-lock.json Add AI cost insights dashboard; rota-informed forecast method 2026-07-24 20:43:18 +00:00
package.json Add AI cost insights dashboard; rota-informed forecast method 2026-07-24 20:43:18 +00:00