fleetmap-reports 1.0.498 → 1.0.499

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.498",
3
+ "version": "1.0.499",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -83,18 +83,18 @@ async function createSpeedingReportByDevice (from, to, userData, traccarInstance
83
83
  const sliced = automaticReports.sliceArray(devices, 10)
84
84
 
85
85
  let deviceCount = 0
86
- for (const slice of sliced) {
87
- const { routes, events } = await getEvents(traccarInstance, from, to, slice, userData, deviceCount, devices.length, slice.length)
88
- if (processServerSide()) {
89
- console.log('LOADING_MESSAGE:' + slice[0].name)
90
- console.log(`PROGRESS_PERC:${deviceCount / devices.length * 100}`)
91
- }
86
+ await Promise.all(sliced.map(async slice => {
87
+ const { routes, events } = await getEvents(traccarInstance, from, to, slice, userData, deviceCount, devices.length, slice.length)
92
88
  if (events.length > 0) {
93
89
  const devicesProcessed = await processDevices(from, to, slice, events, routes, userData)
94
90
  allData.devices.push(...devicesProcessed)
95
91
  }
96
92
  deviceCount = deviceCount + slice.length
97
- }
93
+ if (processServerSide()) {
94
+ console.log('LOADING_MESSAGE:' + slice[0].name)
95
+ console.log(`PROGRESS_PERC:${deviceCount / devices.length * 100}`)
96
+ }
97
+ }))
98
98
 
99
99
  return allData
100
100
  }