fleetmap-reports 1.0.437 → 1.0.438
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/idle-report.js +9 -1
package/package.json
CHANGED
package/src/idle-report.js
CHANGED
|
@@ -11,6 +11,14 @@ const { reportByDriver } = require('./util/driver')
|
|
|
11
11
|
|
|
12
12
|
const fileName = 'IdleReport'
|
|
13
13
|
|
|
14
|
+
function getDriver (idleEvent, drivers) {
|
|
15
|
+
if (idleEvent && idleEvent.position && idleEvent.position.attributes.driverUniqueId) {
|
|
16
|
+
const driver = drivers.find(d => d.uniqueId === idleEvent.position.attributes.driverUniqueId)
|
|
17
|
+
return driver ? driver.name : idleEvent.position.attributes.driverUniqueId
|
|
18
|
+
}
|
|
19
|
+
return ''
|
|
20
|
+
}
|
|
21
|
+
|
|
14
22
|
async function createIdleReport (from, to, userData, traccarInstance) {
|
|
15
23
|
console.log('Create IdleReport')
|
|
16
24
|
const reportData = []
|
|
@@ -312,7 +320,7 @@ function exportIdleReportToExcel (userData, reportData) {
|
|
|
312
320
|
name: userData.byDriver ? d.driver.name : d.device.name,
|
|
313
321
|
duration: convertMS(a.idleTime, true),
|
|
314
322
|
fixTime: getIdleEventDate(a, userData.user),
|
|
315
|
-
subname: userData.byDriver ? a.deviceName : a.
|
|
323
|
+
subname: userData.byDriver ? a.deviceName : getDriver(a, userData.drivers),
|
|
316
324
|
address: a.position.address + (a.geofenceName ? ' - ' + a.geofenceName : '')
|
|
317
325
|
}
|
|
318
326
|
}))
|