Temp: log user fields + shift status cost breakdown
This commit is contained in:
parent
5372111f52
commit
cf0cd0a5e4
1 changed files with 4 additions and 0 deletions
|
|
@ -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 = {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue