fleetmap-reports 1.0.405 → 1.0.406
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 +1 -1
- package/src/util/traccar.js +3 -5
- package/src/zone-report.js +1 -1
package/package.json
CHANGED
package/src/util/traccar.js
CHANGED
|
@@ -65,16 +65,15 @@ async function getSummary (traccar, from, to, devices) {
|
|
|
65
65
|
return result.map(r => r.data).flat()
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
async function getAllInOne (traccar, from, to, devices, getRoutes, getTrips, getStops, getSummary, currentDeviceCount = 0, totalDevices = devices.length) {
|
|
68
|
+
async function getAllInOne (traccar, from, to, devices, getRoutes, getTrips, getStops, getSummary, currentDeviceCount = 0, totalDevices = devices.length, sliceSize= 5) {
|
|
69
69
|
let url = `/reports/allinone?&from=${from.toISOString()}&to=${to.toISOString()}`
|
|
70
70
|
if (getRoutes) url += '&type=route'
|
|
71
71
|
if (getTrips) url += '&type=trips'
|
|
72
72
|
if (getStops) url += '&type=stops'
|
|
73
73
|
if (getSummary) url += '&type=summary'
|
|
74
74
|
|
|
75
|
-
const sliced = automaticReports.sliceArray(devices,
|
|
75
|
+
const sliced = automaticReports.sliceArray(devices, sliceSize)
|
|
76
76
|
const result = []
|
|
77
|
-
let deviceCount = currentDeviceCount
|
|
78
77
|
for (const chunk of sliced) {
|
|
79
78
|
const requests = chunk.map(d =>
|
|
80
79
|
traccar.axios.get(url + '&' + `deviceId=${d.id}`, {
|
|
@@ -82,8 +81,7 @@ async function getAllInOne (traccar, from, to, devices, getRoutes, getTrips, get
|
|
|
82
81
|
withCredentials: true
|
|
83
82
|
}).then(r => r.data).then(x => {
|
|
84
83
|
console.log('LOADING_MESSAGE:' + d.name)
|
|
85
|
-
|
|
86
|
-
console.log(`PROGRESS_PERC:${deviceCount / totalDevices * 100}`)
|
|
84
|
+
console.log(`PROGRESS_PERC:${currentDeviceCount++ / totalDevices * 100}`)
|
|
87
85
|
return x
|
|
88
86
|
}))
|
|
89
87
|
result.push(...(await Promise.all(requests)))
|
package/src/zone-report.js
CHANGED
|
@@ -58,7 +58,7 @@ async function createZoneReport(from, to, userData, traccar) {
|
|
|
58
58
|
|
|
59
59
|
let deviceCount = 0
|
|
60
60
|
for(const slice of sliced) {
|
|
61
|
-
const allInOne = await traccarHelper.getAllInOne(traccar, from, to, slice, true, false, false, false, deviceCount, devices.length)
|
|
61
|
+
const allInOne = await traccarHelper.getAllInOne(traccar, from, to, slice, true, false, false, false, deviceCount, devices.length, 20)
|
|
62
62
|
const routeData = allInOne.route
|
|
63
63
|
|
|
64
64
|
const data = getInAndOutEvents(slice, routeData, userData)
|