1. Weekly fetch step (not per-day): timesheets/on/{date} returns the
whole weekly period for any date in that week, so fetching 30 days
counted each weekly timesheet ~7x. Now fetches one date per 7-day
step from 'to' backwards (PBI pattern), deduplicates by timesheet.id,
and filters shifts by sh.date to the requested window.
2. Filter by user.report_department_id not shift.department_id: shared
departments (HR, Management, etc.) have a single location assignment
(No 4) but staff from all hotels clock into them. Filtering by the
employee's HOME department (report_department_id) correctly isolates
No 4 staff. Mirrors the PBI model join: timesheet → user →
report_department_id → department.location_id → hotel.
Both fixes applied to syncActuals and compareEndpoints diagnostic.
Target: B.cost = WF "Timesheet exc. leave inc. allowances" (~£51k June).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| src | ||
| Dockerfile | ||
| package.json | ||