fleetmap-reports 2.0.19 → 2.0.21

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": "2.0.19",
3
+ "version": "2.0.21",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -89,11 +89,7 @@ async function createSpeedingReportByDevice (from, to, userData, traccarInstance
89
89
  let deviceCount = 0
90
90
  for (const sliced of _sliced) {
91
91
  await Promise.all(sliced.map(async slice => {
92
- const { routes, events } = await getEvents(traccarInstance, from, to, slice, userData, deviceCount, devices.length, slice.length)
93
- if (events.length > 0) {
94
- const devicesProcessed = processDevices(from, to, slice, events, routes, userData)
95
- allData.devices.push(...devicesProcessed)
96
- }
92
+ allData.devices = allData.devices.concat(await getEvents(traccarInstance, from, to, slice, userData, deviceCount, devices.length, slice.length))
97
93
  deviceCount = deviceCount + slice.length
98
94
  if (processServerSide()) {
99
95
  console.log('LOADING_MESSAGE:' + slice[0].name)
@@ -153,7 +149,10 @@ async function getEvents (traccarInstance, from, to, devices, userData, deviceCo
153
149
  events.push(...traccarEvents)
154
150
  }
155
151
  }
156
- return { routes, events }
152
+ if (events.length > 0) {
153
+ return processDevices(from, to, devices, events, routes, userData)
154
+ }
155
+ return []
157
156
  }
158
157
  }
159
158
 
package/src/util/utils.js CHANGED
@@ -127,7 +127,7 @@ function getDates (startDate, endDate, timezone) {
127
127
  }
128
128
 
129
129
  function getImage (url) {
130
- return axios.get(url, { responseType: 'arraybuffer' }).then(d => d.data)
130
+ return require('axios').get(url, { responseType: 'arraybuffer' }).then(d => d.data)
131
131
  }
132
132
 
133
133
  async function getImageBase64 (url) {