fleetmap-reports 2.0.190 → 2.0.192
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 -2
- package/src/util/traccar.js +4 -5
- package/src/zone-report.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fleetmap-reports",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.192",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
"wkt": "^0.1.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"axios-debug-log": "^0.8.4",
|
|
31
30
|
"eslint": "^8.15.0",
|
|
32
31
|
"eslint-config-standard": "^17.0.0",
|
|
33
32
|
"eslint-plugin-import": "^2.26.0",
|
package/src/util/traccar.js
CHANGED
|
@@ -96,7 +96,6 @@ async function getAllInOne (
|
|
|
96
96
|
console.log(u)
|
|
97
97
|
requests.push(
|
|
98
98
|
traccar.axios.get(u, {
|
|
99
|
-
jar: traccar.cookieJar,
|
|
100
99
|
withCredentials: true,
|
|
101
100
|
timeout: 900000
|
|
102
101
|
}).catch(e => {
|
|
@@ -110,12 +109,12 @@ async function getAllInOne (
|
|
|
110
109
|
console.log('LOADING_MESSAGE:' + _chunk[0].name)
|
|
111
110
|
if (counter) {
|
|
112
111
|
counter.count += devicesPerRequest
|
|
113
|
-
ignorePercentage || console.log(`PROGRESS_PERC:${counter.count / totalDevices * 100}`)
|
|
112
|
+
ignorePercentage || console.log(`PROGRESS_PERC:${Math.round(counter.count / totalDevices * 100)}`)
|
|
114
113
|
} else {
|
|
115
114
|
currentDeviceCount += devicesPerRequest
|
|
116
|
-
ignorePercentage || console.log(`PROGRESS_PERC:${currentDeviceCount / totalDevices * 100}`)
|
|
115
|
+
ignorePercentage || console.log(`PROGRESS_PERC:${Math.round(currentDeviceCount / totalDevices * 100)}`)
|
|
117
116
|
}
|
|
118
|
-
console.log(_chunk.map(d =>
|
|
117
|
+
console.log('done devices', _chunk.map(d => d.id), 'position count:', x.route && x.route.length)
|
|
119
118
|
return x
|
|
120
119
|
}))
|
|
121
120
|
}
|
|
@@ -124,7 +123,7 @@ async function getAllInOne (
|
|
|
124
123
|
try {
|
|
125
124
|
result.push(...(await Promise.all(requests)))
|
|
126
125
|
} catch (e) {
|
|
127
|
-
console.log('parallel', e.message, e.config
|
|
126
|
+
console.log('parallel', e.message, e.config)
|
|
128
127
|
}
|
|
129
128
|
console.log('took', new Date() - now, 'ms')
|
|
130
129
|
}
|
package/src/zone-report.js
CHANGED
|
@@ -23,7 +23,7 @@ const { checkGeofenceIn } = require('./util/geofence')
|
|
|
23
23
|
const { parallel } = require('./util/parallel')
|
|
24
24
|
const { getDataByDay } = require('./util/trips')
|
|
25
25
|
const axios = require('axios').default
|
|
26
|
-
const sliceSize =
|
|
26
|
+
const sliceSize = 3
|
|
27
27
|
const fileName = 'ZoneReport'
|
|
28
28
|
|
|
29
29
|
async function createZoneReport (from, to, userData, traccar) {
|
|
@@ -482,7 +482,7 @@ function analyseAlerts (alerts, deviceRoute, userData, from, to, device) {
|
|
|
482
482
|
async function getInAndOutEvents (devices, route, userData) {
|
|
483
483
|
const events = []
|
|
484
484
|
const geofencesFeatures = userData.geofences.map(g => convertToFeature(g))
|
|
485
|
-
console.log('getInAndOutEvents', devices)
|
|
485
|
+
console.log('getInAndOutEvents', devices.length)
|
|
486
486
|
devices.forEach(d => {
|
|
487
487
|
const deviceRoute = route.filter(p => p.deviceId === d.id)
|
|
488
488
|
const routePoints = deviceRoute.sort(sortPositions).map(p => convertPositionToFeature(p))
|