fleetmap-reports 1.0.408 → 1.0.409
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/zone-report.js +13 -10
package/package.json
CHANGED
package/src/zone-report.js
CHANGED
|
@@ -30,7 +30,7 @@ async function createZoneReport (from, to, userData, traccar) {
|
|
|
30
30
|
group: g,
|
|
31
31
|
xpert: devices.filter(d => d.attributes.xpert).length > 0
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
console.log('LOADING_MESSAGE:' + 'Eventos...')
|
|
34
34
|
const response = await traccar.reports.reportsEventsGet(from, to, null, [g.id], types)
|
|
35
35
|
const data = response.data
|
|
36
36
|
|
|
@@ -56,21 +56,24 @@ async function createZoneReport (from, to, userData, traccar) {
|
|
|
56
56
|
const sliced = automaticReports.sliceArray(devices, 50)
|
|
57
57
|
|
|
58
58
|
let deviceCount = 0
|
|
59
|
+
const promises = []
|
|
59
60
|
for (const slice of sliced) {
|
|
60
|
-
|
|
61
|
+
promises.push(traccarHelper.getAllInOne(
|
|
61
62
|
traccar, from, to, slice, true, false, false, false,
|
|
62
|
-
deviceCount, devices.length, 30,
|
|
63
|
-
|
|
63
|
+
deviceCount, devices.length, 30, 5).then(async allInOne => {
|
|
64
|
+
const routeData = allInOne.route
|
|
64
65
|
|
|
65
|
-
|
|
66
|
+
const data = getInAndOutEvents(slice, routeData, userData)
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
console.log('Geofence Enter/Exit Alerts:' + data.length)
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
if (data.length) {
|
|
71
|
+
allData.devices.push(...await processDevices(from, to, devices, userData.drivers, userData.geofences, data, traccar))
|
|
72
|
+
}
|
|
73
|
+
deviceCount = deviceCount + slice.length
|
|
74
|
+
}))
|
|
73
75
|
}
|
|
76
|
+
await Promise.all(promises)
|
|
74
77
|
|
|
75
78
|
reportData.push(allData)
|
|
76
79
|
|