fleetmap-reports 2.0.275 → 2.0.276
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 +15 -14
- package/src/tests/positions.test.js +1 -1
package/package.json
CHANGED
package/src/location-report.js
CHANGED
|
@@ -55,8 +55,8 @@ async function createLocationReportByDriver (from, to, userData, traccar) {
|
|
|
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
|
-
const filtered = batchResults.filter(r => r)
|
|
59
|
-
console.log(i, '/', devices.length, 'pushing', filtered)
|
|
58
|
+
const filtered = batchResults.filter(r => r && r.length)
|
|
59
|
+
console.log(i, '/', devices.length, 'pushing', filtered, batchResults)
|
|
60
60
|
results.push(...filtered)
|
|
61
61
|
}
|
|
62
62
|
return { drivers: results.flat() }
|
|
@@ -64,7 +64,6 @@ async function createLocationReportByDriver (from, to, userData, traccar) {
|
|
|
64
64
|
|
|
65
65
|
async function _getDriverRoute (traccar, from, to, slice, deviceCount, devices, userData) {
|
|
66
66
|
const url = `https://${process.env.SERVER_HOST}/pinmeapi/process-report/get-driver-route`
|
|
67
|
-
console.log(url, slice.length, slice[0].id, userData.drivers)
|
|
68
67
|
return traccar.axios.post(url, {
|
|
69
68
|
from,
|
|
70
69
|
to,
|
|
@@ -73,16 +72,18 @@ async function _getDriverRoute (traccar, from, to, slice, deviceCount, devices,
|
|
|
73
72
|
devices,
|
|
74
73
|
userData
|
|
75
74
|
}, { timeout: 1000 * 60 * 5 })
|
|
76
|
-
.catch(() =>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
75
|
+
.catch((e) => {
|
|
76
|
+
console.error('moving on', e)
|
|
77
|
+
return traccar.axios.post(url, {
|
|
78
|
+
from,
|
|
79
|
+
to,
|
|
80
|
+
slice,
|
|
81
|
+
deviceCount,
|
|
82
|
+
devices,
|
|
83
|
+
userData
|
|
84
|
+
}).then(d => d.data)
|
|
85
|
+
})
|
|
86
|
+
.then(d => d && d.data)
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
async function getDriverRoute (traccar, from, to, slice, deviceCount, devices, userData) {
|
|
@@ -96,7 +97,7 @@ async function getDriverRoute (traccar, from, to, slice, deviceCount, devices, u
|
|
|
96
97
|
false,
|
|
97
98
|
true
|
|
98
99
|
)
|
|
99
|
-
|
|
100
|
+
return processDrivers(from, to, userData, allInOne)
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
async function createLocationReportByGroup (from, to, userData, traccar) {
|
|
@@ -27,7 +27,7 @@ describe('test positions', function () {
|
|
|
27
27
|
try {
|
|
28
28
|
const userData = await report.getUserData()
|
|
29
29
|
userData.byDriver = true
|
|
30
|
-
userData.drivers =
|
|
30
|
+
userData.drivers = userData.drivers.filter(d => d.name.startsWith('ERICA'))
|
|
31
31
|
const data = await report.locationReport(
|
|
32
32
|
new Date(Date.UTC(2025, 0, 1, 0, 0, 0)),
|
|
33
33
|
new Date(Date.UTC(2025, 0, 31, 23, 59, 59, 0)),
|