fleetmap-reports 1.0.540 → 1.0.542
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/zone-report.js +6 -3
package/package.json
CHANGED
package/src/zone-report.js
CHANGED
|
@@ -12,7 +12,7 @@ const booleanPointInPolygon = require('@turf/boolean-point-in-polygon')
|
|
|
12
12
|
const distance = require('@turf/distance')
|
|
13
13
|
const axios = require('axios')
|
|
14
14
|
const { processServerSide } = require('./util')
|
|
15
|
-
|
|
15
|
+
const sliceSize = 400
|
|
16
16
|
const fileName = 'ZoneReport'
|
|
17
17
|
|
|
18
18
|
async function createZoneReport (from, to, userData, traccar) {
|
|
@@ -58,13 +58,13 @@ async function createZoneReport (from, to, userData, traccar) {
|
|
|
58
58
|
xpert: devices.filter(d => d.attributes.xpert).length > 0
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const sliced = automaticReports.sliceArray(devices,
|
|
61
|
+
const sliced = automaticReports.sliceArray(devices, sliceSize)
|
|
62
62
|
|
|
63
63
|
let deviceCount = 0
|
|
64
64
|
for (const slice of sliced) {
|
|
65
65
|
const data = await getAllInOne(
|
|
66
66
|
traccar, from, to, slice, true, false, false, false,
|
|
67
|
-
deviceCount, devices.length,
|
|
67
|
+
deviceCount, devices.length, sliceSize, 5, undefined, userData)
|
|
68
68
|
|
|
69
69
|
console.log('Geofence Enter/Exit Alerts:' + data.length)
|
|
70
70
|
|
|
@@ -102,7 +102,10 @@ async function getAllInOne (
|
|
|
102
102
|
|
|
103
103
|
const sliced = automaticReports.sliceArray(devices, sliceSize)
|
|
104
104
|
const result = []
|
|
105
|
+
console.log('getAll, slicing', sliceSize)
|
|
106
|
+
let iteration = 0
|
|
105
107
|
for (const chunk of sliced) {
|
|
108
|
+
console.log('iteration', ++iteration)
|
|
106
109
|
const requests = []
|
|
107
110
|
for (const _chunk of automaticReports.sliceArray(chunk, devicesPerRequest)) {
|
|
108
111
|
const u = url + '&' + _chunk.map(d => `deviceId=${d.id}`).join('&')
|