fleetmap-reports 2.0.272 → 2.0.274
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/location-report.js +5 -3
- package/src/speeding-report.js +1 -1
package/package.json
CHANGED
package/src/location-report.js
CHANGED
|
@@ -51,11 +51,13 @@ async function createLocationReportByDriver (from, to, userData, traccar) {
|
|
|
51
51
|
|
|
52
52
|
const deviceCount = 0
|
|
53
53
|
const results = []
|
|
54
|
-
const batchSize =
|
|
54
|
+
const batchSize = 5
|
|
55
55
|
for (let i = 0; i < devices.length; i += batchSize) {
|
|
56
56
|
const batch = devices.slice(i, i + batchSize)
|
|
57
57
|
const batchResults = await Promise.all(batch.map(device => _getDriverRoute(traccar, from, to, [device], deviceCount, devices, userData)))
|
|
58
|
-
|
|
58
|
+
const filtered = batchResults.filter(r => r)
|
|
59
|
+
console.log(i, '/', devices.length, 'pushing', filtered)
|
|
60
|
+
results.push(...filtered)
|
|
59
61
|
}
|
|
60
62
|
return { drivers: results.flat() }
|
|
61
63
|
}
|
|
@@ -69,7 +71,7 @@ async function _getDriverRoute (traccar, from, to, slice, deviceCount, devices,
|
|
|
69
71
|
deviceCount,
|
|
70
72
|
devices,
|
|
71
73
|
userData
|
|
72
|
-
}).then(d => d.data)
|
|
74
|
+
}, { timeout: 1000 * 60 * 5 }).then(d => d.data)
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
async function getDriverRoute (traccar, from, to, slice, deviceCount, devices, userData) {
|
package/src/speeding-report.js
CHANGED
|
@@ -79,7 +79,7 @@ function processServerSide () {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
async function getOverspeedEvents (from, to, userData, devices, allData, traccarInstance) {
|
|
82
|
-
const _sliced = automaticReports.sliceArray(automaticReports.sliceArray(devices,
|
|
82
|
+
const _sliced = automaticReports.sliceArray(automaticReports.sliceArray(devices, 5), 5)
|
|
83
83
|
let deviceCount = 0
|
|
84
84
|
const overspeedEvents = []
|
|
85
85
|
for (const sliced of _sliced) {
|