Fix employee name lookup — use name field not first_name/last_name; remove temp logs
This commit is contained in:
parent
6661189127
commit
95103280c3
1 changed files with 1 additions and 5 deletions
|
|
@ -76,9 +76,8 @@ async function getDeptNameMap() {
|
||||||
|
|
||||||
async function getUserNameMap() {
|
async function getUserNameMap() {
|
||||||
const all = await wfFetchPaged('/api/v2/users')
|
const all = await wfFetchPaged('/api/v2/users')
|
||||||
if (all.length > 0) console.log('USER_SAMPLE', JSON.stringify(all[0]))
|
|
||||||
return Object.fromEntries(
|
return Object.fromEntries(
|
||||||
all.map(u => [String(u.id), `${u.first_name || ''} ${u.last_name || ''}`.trim() || `User ${u.id}`])
|
all.map(u => [String(u.id), u.name || `${u.legal_first_name || ''} ${u.legal_last_name || ''}`.trim() || `User ${u.id}`])
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,9 +91,6 @@ export async function syncActuals(from, to) {
|
||||||
|
|
||||||
const shifts = await wfFetchPaged(path)
|
const shifts = await wfFetchPaged(path)
|
||||||
const [deptNameMap, userNameMap] = await Promise.all([getDeptNameMap(), getUserNameMap()])
|
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 byDateDept = {}
|
||||||
const byDateDeptEmp = {}
|
const byDateDeptEmp = {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue