From cf0cd0a5e43cf5b29fa51e3db80126bf53e9d154 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Thu, 23 Jul 2026 11:31:03 +0000 Subject: [PATCH] Temp: log user fields + shift status cost breakdown --- backend/src/lib/workforce.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/src/lib/workforce.js b/backend/src/lib/workforce.js index 953d79e..7fd1ca5 100644 --- a/backend/src/lib/workforce.js +++ b/backend/src/lib/workforce.js @@ -79,6 +79,7 @@ async function getUserNameMap() { const locationId = creds.location_id ? String(creds.location_id) : null const all = await wfFetchPaged('/api/v2/users') const filtered = locationId ? all.filter(u => String(u.location_id) === locationId) : all + if (filtered.length > 0) console.log('USER_SAMPLE', JSON.stringify(filtered[0])) return Object.fromEntries( filtered.map(u => [String(u.id), `${u.first_name || ''} ${u.last_name || ''}`.trim() || `User ${u.id}`]) ) @@ -94,6 +95,9 @@ export async function syncActuals(from, to) { const shifts = await wfFetchPaged(path) const [deptNameMap, userNameMap] = await Promise.all([getDeptNameMap(), getUserNameMap()]) + const statusCosts = {} + for (const s of shifts) { statusCosts[s.status] = (statusCosts[s.status] || 0) + parseFloat(s.cost_with_oncosts ?? s.cost ?? 0) } + console.log('SHIFT_STATUS_COSTS', JSON.stringify(statusCosts)) const byDateDept = {} const byDateDeptEmp = {}