fleetmap-reports 2.0.221 → 2.0.223
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/util/traccar.js +2 -3
- package/src/zone-report.js +4 -5
package/package.json
CHANGED
package/src/util/traccar.js
CHANGED
|
@@ -2,7 +2,7 @@ const automaticReports = require('../automaticReports')
|
|
|
2
2
|
const { convertFromUTC, isClientSide, convertFromLocal } = require('./utils')
|
|
3
3
|
const path = require('path')
|
|
4
4
|
const Piscina = require('piscina')
|
|
5
|
-
const {cleanPositions,
|
|
5
|
+
const { cleanPositions, filterPosition } = require('./route')
|
|
6
6
|
const piscina = new Piscina()
|
|
7
7
|
async function getRoute (traccar, from, to, devices) {
|
|
8
8
|
const devicesToSlice = devices.slice()
|
|
@@ -107,8 +107,7 @@ function streamJson (traccar, u, filter) {
|
|
|
107
107
|
filter
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
|
-
filename: path.resolve(__dirname, './traccar.worker.js')
|
|
111
|
-
maxThreads: require('os').cpus().length
|
|
110
|
+
filename: path.resolve(__dirname, './traccar.worker.js')
|
|
112
111
|
})
|
|
113
112
|
}
|
|
114
113
|
|
package/src/zone-report.js
CHANGED
|
@@ -16,18 +16,17 @@ const {
|
|
|
16
16
|
} = require('fleetmap-partners')
|
|
17
17
|
const { devicesToProcess } = require('./util/device')
|
|
18
18
|
const {
|
|
19
|
-
filterPositions,
|
|
20
19
|
cleanPositions
|
|
21
20
|
} = require('./util/route')
|
|
22
21
|
const { checkGeofenceIn } = require('./util/geofence')
|
|
23
22
|
const { parallel } = require('./util/parallel')
|
|
24
23
|
const { getDataByDay } = require('./util/trips')
|
|
25
24
|
const axios = require('axios').default
|
|
26
|
-
const sliceSize =
|
|
25
|
+
const sliceSize = 5
|
|
27
26
|
const deviceChunk = 5
|
|
28
27
|
const fileName = 'ZoneReport'
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
exports.process = async (traccar, from, to, slice, deviceCount, devices, reportRangeDays, userData) => {
|
|
31
30
|
const data = await traccarHelper.getAllInOne(
|
|
32
31
|
traccar, from, to, slice, true, false, false, false,
|
|
33
32
|
deviceCount, devices.length, sliceSize, reportRangeDays > 29 ? 1 : deviceChunk, undefined, false, true)
|
|
@@ -86,9 +85,9 @@ async function createZoneReport (from, to, userData, traccar) {
|
|
|
86
85
|
|
|
87
86
|
let deviceCount = 0
|
|
88
87
|
for (const slice of sliced) {
|
|
89
|
-
const
|
|
88
|
+
const url = `https://${process.env.SERVER_HOST}/pinmeapi/reports/zone-report-processing`
|
|
89
|
+
const processed = await traccar.axios.post(url, { from, to, userData, slice, deviceCount, devices, reportRangeDays }).then(d => d.data)
|
|
90
90
|
allData.devices.push(...processed)
|
|
91
|
-
|
|
92
91
|
deviceCount = deviceCount + slice.length
|
|
93
92
|
}
|
|
94
93
|
|