Fix timesheet sync overwriting future rota dates with empty data

Pull timesheets was writing source='timesheet' rows for future dates
(no clock-in data yet), giving ? / 0.00h and preventing rota sync
from ever healing those dates.

Three-part fix:
- Backend runTimesheetSync: cap end date to today before looping
- Frontend syncTimesheetData: cap end date to today before calling API
- Backend runRotaSync: only skip timesheet-sourced dates that are <= today,
  so any future dates accidentally marked as timesheet are self-healed
  next time rota sync runs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-23 12:08:36 +00:00
parent ffefa1914f
commit c19460ecb3
5 changed files with 34 additions and 26 deletions

View file

@ -317,7 +317,8 @@ export function Planner() {
async function syncTimesheetData() {
if (!bookings) return
const start = bookings.dates[0]
const end = bookings.dates[bookings.dates.length - 1]
const today = todayStr()
const end = bookings.dates[bookings.dates.length - 1] > today ? today : bookings.dates[bookings.dates.length - 1]
setTimesheetSyncing(true)
try {
await syncTimesheets(start, end)