fleetmap-reports 1.0.358 → 1.0.361

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.358",
3
+ "version": "1.0.361",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -54,7 +54,9 @@ 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}`)
58
60
  const response = await traccar.reports.reportsRouteGet(from, to, a.map(d => d.id))
59
61
  data = data.concat(response.data)
60
62
  }
@@ -117,7 +117,7 @@ async function createTripReportByDriver(from, to, userData, traccar){
117
117
  function processDevices(from, to, devices, data, userData) {
118
118
  const devicesResult = []
119
119
 
120
- devices.forEach(d => {
120
+ devices.forEach((d, index) => {
121
121
  const route = data.route.filter(t => t.deviceId === d.id)
122
122
  const trips = data.trips.filter(t => t.deviceId === d.id
123
123
  && (userData.allWeek || !userData.weekDays || isInsideTimetable(t, userData) || isPartialInsideTimetable(t, userData, route)))
@@ -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)