diff --git a/backend/src/lib/workforce.js b/backend/src/lib/workforce.js index 7fd1ca5..e66715e 100644 --- a/backend/src/lib/workforce.js +++ b/backend/src/lib/workforce.js @@ -75,13 +75,10 @@ async function getDeptNameMap() { } async function getUserNameMap() { - const creds = await getWorkforceCreds() - 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])) + const all = await wfFetchPaged('/api/v2/users') + if (all.length > 0) console.log('USER_SAMPLE', JSON.stringify(all[0])) return Object.fromEntries( - filtered.map(u => [String(u.id), `${u.first_name || ''} ${u.last_name || ''}`.trim() || `User ${u.id}`]) + all.map(u => [String(u.id), `${u.first_name || ''} ${u.last_name || ''}`.trim() || `User ${u.id}`]) ) } @@ -125,8 +122,8 @@ export async function syncActuals(from, to) { byDateDept[key].total_cost += totalCost byDateDept[key].shift_count += 1 - // detail by date+dept+employee (APPROVED only — pending have cost 0 but clutter the list) - if (s.status === 'APPROVED') { + // detail by date+dept+employee — include any shift that contributed cost to the aggregate + if (totalCost > 0 || baseCost > 0) { const empId = String(s.user_id) const empName = userNameMap[empId] || `Employee ${empId}` const empKey = `${date}:${deptId}:${empId}`