fleetmap-reports 1.0.380 → 1.0.381
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/trip-report.js +8 -8
- package/src/util/traccar.js +1 -0
package/package.json
CHANGED
package/src/trip-report.js
CHANGED
|
@@ -44,12 +44,13 @@ async function createTripReportByDevice(from, to, userData, traccar) {
|
|
|
44
44
|
|
|
45
45
|
devices.sort((a, b) => (a.name > b.name) ? 1 : -1)
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
const devicesToSlice = devices.slice()
|
|
48
|
+
const sliced = automaticReports.sliceArray(devicesToSlice, 5)
|
|
48
49
|
|
|
49
50
|
console.log('LOADING_MESSAGE:' + devices.map(d => d.name).join(', '))
|
|
50
51
|
let deviceCount = 0
|
|
51
|
-
for(const
|
|
52
|
-
const allInOne = await traccarHelper.getAllInOne(traccar, from, to,
|
|
52
|
+
for(const slice of sliced) {
|
|
53
|
+
const allInOne = await traccarHelper.getAllInOne(traccar, from, to, slice, true, true, true, false)
|
|
53
54
|
const tripsData = allInOne.trips
|
|
54
55
|
const stopsData = allInOne.stops
|
|
55
56
|
const routeData = allInOne.route
|
|
@@ -57,16 +58,15 @@ async function createTripReportByDevice(from, to, userData, traccar) {
|
|
|
57
58
|
console.log('Trips:' + tripsData.length)
|
|
58
59
|
|
|
59
60
|
if (tripsData.length > 0) {
|
|
60
|
-
trips.checkTripsKms(traccar, from, to,
|
|
61
|
-
allData.devices.push(...processDevices(from, to,
|
|
61
|
+
trips.checkTripsKms(traccar, from, to, slice, {trips: tripsData, route: routeData})
|
|
62
|
+
allData.devices.push(...processDevices(from, to, slice, {
|
|
62
63
|
trips: tripsData,
|
|
63
64
|
stops: stopsData,
|
|
64
65
|
route: routeData
|
|
65
66
|
}, userData))
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
-
console.log(
|
|
69
|
-
console.log(`PROGRESS_PERC:${++deviceCount / devices.length * 100}`)
|
|
68
|
+
deviceCount = deviceCount + slice.length
|
|
69
|
+
console.log(`PROGRESS_PERC:${deviceCount / devices.length * 100}`)
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
return allData
|
package/src/util/traccar.js
CHANGED
|
@@ -80,6 +80,7 @@ async function getAllInOne(traccar, from, to, devices, getRoutes, getTrips, getS
|
|
|
80
80
|
jar: traccar.cookieJar,
|
|
81
81
|
withCredentials: true
|
|
82
82
|
}).then(r => r.data).then(x => {
|
|
83
|
+
console.log('LOADING_MESSAGE:' + d.name)
|
|
83
84
|
return x
|
|
84
85
|
}))
|
|
85
86
|
result.push(...(await Promise.all(requests)))
|