Add include_oncosts=true to timesheets/on/{date} fetch

Without this parameter, nested shifts[] only return shift.cost with no
cost_with_oncosts field. The FD's PBI uses show_costs=true on timesheets
and may also require include_oncosts=true to get employer oncost fields.
This is the missing parameter that may explain the B.oncostTotal == baseCost issue.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-23 15:14:17 +00:00
parent be1ef7f99e
commit 2543e09387

View file

@ -94,10 +94,9 @@ function weeklyFetchDates(from, to) {
}
// Fetch timesheets for a single date — no location param (mirrors PBI pattern).
// Returns the weekly timesheet record(s) containing this date.
// Each record: { id, user_id, shifts: [{ department_id, date, cost, leave_request_id, ... }] }
// include_oncosts=true is required to get cost_with_oncosts on nested shifts[].
async function fetchTimesheetsForDate(dateStr) {
try { return await wfFetchPaged(`/api/v2/timesheets/on/${dateStr}?show_costs=true`) }
try { return await wfFetchPaged(`/api/v2/timesheets/on/${dateStr}?show_costs=true&include_oncosts=true`) }
catch { return [] }
}