fleetmap-reports 1.0.359 → 1.0.362

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.359",
3
+ "version": "1.0.362",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -54,7 +54,10 @@ async function createLocationReport(from, to, userData, traccar) {
54
54
 
55
55
  const arrayOfArrays = automaticReports.sliceArray(devicesToSlice)
56
56
  let data = []
57
+ let i = 0
57
58
  for (const a of arrayOfArrays) {
59
+ console.log(`PROGRESS_PERC:${++i/arrayOfArrays.length*100}`)
60
+ console.log('LOADING_MESSAGE:' + a.map(d => d.name).join(', '))
58
61
  const response = await traccar.reports.reportsRouteGet(from, to, a.map(d => d.id))
59
62
  data = data.concat(response.data)
60
63
  }
@@ -124,7 +124,6 @@ function processDevices(from, to, devices, data, userData) {
124
124
  const stops = data.stops.filter(s => s.deviceId === d.id)
125
125
 
126
126
  console.log('LOADING_MESSAGE:' + d.name)
127
- console.log(`PROGRESS_PERC:${index/devices.length*100}`)
128
127
 
129
128
  addNearestPOIs(trips, userData)
130
129
 
@@ -75,9 +75,11 @@ async function getAllInOne(traccar, from, to, devices, getRoutes, getTrips, getS
75
75
  console.log('LOADING_MESSAGE:' + devices.map(d => d.name).join(', '))
76
76
 
77
77
  const sliced = automaticReports.sliceArray(devices)
78
+ let deviceCount = 0
78
79
  const requests = sliced.map(a =>
79
80
  traccar.axios.get(url + '&' + a.map(d => `deviceId=${d.id}`).join('&')).then(r => r.data).then(x => {
80
81
  console.log('LOADING_MESSAGE:' + a.map(d => d.name).join(', '))
82
+ console.log(`PROGRESS_PERC:${++deviceCount/sliced.length*100}`)
81
83
  return x
82
84
  }))
83
85
  const result = await Promise.all(requests)