fleetmap-reports 1.0.696 → 1.0.698

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.696",
3
+ "version": "1.0.698",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -30,10 +30,14 @@ async function createZoneReport (from, to, userData, traccar) {
30
30
  if (processServerSide(userData)) {
31
31
  const url = `https://${process.env.SERVER_HOST}/reports/zone-report`
32
32
  const sliced = automaticReports.sliceArray(devices, sliceSize)
33
+ const promises = []
33
34
  for (const slice of sliced) {
34
- const data = await axios.post(url, { from, to, userData: { ...userData, devices: slice } }, { withCredentials: true }).then(d => d.data)
35
- allData.devices.push(...(data[0].devices))
35
+ promises.push(axios.post(url, { from, to, userData: { ...userData, devices: slice } }, { withCredentials: true })
36
+ .then(d => d.data)
37
+ .then(data => allData.devices.push(...(data[0].devices)))
38
+ )
36
39
  }
40
+ await Promise.all(promises)
37
41
  reportData.push(allData)
38
42
  return reportData
39
43
  }