fleetmap-reports 1.0.672 → 1.0.674
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/tests/zones.test.js +3 -2
- package/src/util/traccar.js +5 -1
- package/src/zone-report.js +2 -2
package/package.json
CHANGED
package/src/tests/zones.test.js
CHANGED
|
@@ -8,9 +8,10 @@ describe('zones', function () {
|
|
|
8
8
|
console.log(userData.devices.length)
|
|
9
9
|
userData.geofences = userData.geofences.filter(g => g.name === 'Geofence Ellca')
|
|
10
10
|
console.log(userData.geofences)
|
|
11
|
-
await report.zoneReport(
|
|
11
|
+
const result = await report.zoneReport(
|
|
12
12
|
new Date(Date.UTC(2022, 6, 24, 0, 0, 0, 0)),
|
|
13
13
|
new Date(Date.UTC(2022, 6, 25, 23, 59, 59, 0)),
|
|
14
14
|
userData)
|
|
15
|
-
|
|
15
|
+
console.log('result', result)
|
|
16
|
+
}, 4000000)
|
|
16
17
|
})
|
package/src/util/traccar.js
CHANGED
|
@@ -95,7 +95,8 @@ async function getAllInOne (
|
|
|
95
95
|
requests.push(
|
|
96
96
|
traccar.axios.get(u, {
|
|
97
97
|
jar: traccar.cookieJar,
|
|
98
|
-
withCredentials: true
|
|
98
|
+
withCredentials: true,
|
|
99
|
+
timeout: 900000
|
|
99
100
|
}).then(r => r.data).then(x => {
|
|
100
101
|
console.log('LOADING_MESSAGE:' + _chunk[0].name)
|
|
101
102
|
if (counter) {
|
|
@@ -105,10 +106,13 @@ async function getAllInOne (
|
|
|
105
106
|
currentDeviceCount += devicesPerRequest
|
|
106
107
|
console.log(`PROGRESS_PERC:${currentDeviceCount / totalDevices * 100}`)
|
|
107
108
|
}
|
|
109
|
+
console.log(_chunk.map(d => `deviceId=${d.id}`), x.route && x.route.length)
|
|
108
110
|
return x
|
|
109
111
|
}))
|
|
110
112
|
}
|
|
113
|
+
const now = new Date()
|
|
111
114
|
result.push(...(await Promise.all(requests)))
|
|
115
|
+
console.log('took', new Date() - now, 'ms')
|
|
112
116
|
}
|
|
113
117
|
return {
|
|
114
118
|
route: result.filter(t => t.route).map(r => r.route).flat(),
|
package/src/zone-report.js
CHANGED
|
@@ -18,8 +18,8 @@ const distance = require('@turf/distance')
|
|
|
18
18
|
const axios = require('axios')
|
|
19
19
|
const { processServerSide } = require('./util')
|
|
20
20
|
const { filterPositions } = require('./util/route')
|
|
21
|
-
const sliceSize =
|
|
22
|
-
const deviceChunk =
|
|
21
|
+
const sliceSize = 10
|
|
22
|
+
const deviceChunk = 1
|
|
23
23
|
const fileName = 'ZoneReport'
|
|
24
24
|
|
|
25
25
|
async function createZoneReport (from, to, userData, traccar) {
|