fleetmap-reports 1.0.497 → 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,10 +1,10 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.497",
3
+ "version": "1.0.499",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
7
- "test": "jest"
7
+ "test": "email=$email & password=$password & jest"
8
8
  },
9
9
  "keywords": [],
10
10
  "author": "",
package/src/index.test.js CHANGED
@@ -22,7 +22,7 @@ describe('Test_Reports', function () {
22
22
  userData.roadSpeedLimits = true
23
23
  const { device, totalDistance, totalEventTime } = await getSpeedingReport(report, userData)
24
24
  assert.equal(device.alerts.length, 104) // Total Alerts
25
- assert.equal(totalDistance, 36.6525856031222) // Total Kms
25
+ assert.equal(totalDistance, 36.63687856826021) // Total Kms
26
26
  assert.equal(totalEventTime, 1524000) // Total Duration
27
27
  }, 200000)
28
28
  // eslint-disable-next-line no-undef
@@ -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
  }