fleetmap-reports 1.0.691 → 1.0.692
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 +14 -9
package/package.json
CHANGED
package/src/zone-report.js
CHANGED
|
@@ -20,11 +20,23 @@ const deviceChunk = 5
|
|
|
20
20
|
const fileName = 'ZoneReport'
|
|
21
21
|
|
|
22
22
|
async function createZoneReport (from, to, userData, traccar) {
|
|
23
|
+
const reportData = []
|
|
24
|
+
const devices = devicesToProcess(userData)
|
|
25
|
+
const allData = {
|
|
26
|
+
devices: [],
|
|
27
|
+
xpert: devices.filter(d => d.attributes.xpert).length > 0
|
|
28
|
+
}
|
|
29
|
+
|
|
23
30
|
if (processServerSide(userData)) {
|
|
24
31
|
const url = `https://${process.env.SERVER_HOST}/reports/zone-report`
|
|
25
|
-
|
|
32
|
+
const sliced = automaticReports.sliceArray(devices, sliceSize)
|
|
33
|
+
for (const slice of sliced) {
|
|
34
|
+
const data = await axios.post(url, { from, to, userData: { ...userData, devices: slice } }, { withCredentials: true }).then(d => d.data)
|
|
35
|
+
allData.devices.push(...(data[0].devices))
|
|
36
|
+
}
|
|
37
|
+
reportData.push(allData)
|
|
38
|
+
return reportData
|
|
26
39
|
}
|
|
27
|
-
const reportData = []
|
|
28
40
|
const types = ['geofenceEnter', 'geofenceExit']
|
|
29
41
|
|
|
30
42
|
if (userData.byGroup) {
|
|
@@ -50,13 +62,6 @@ async function createZoneReport (from, to, userData, traccar) {
|
|
|
50
62
|
}
|
|
51
63
|
}
|
|
52
64
|
|
|
53
|
-
const devices = devicesToProcess(userData)
|
|
54
|
-
|
|
55
|
-
const allData = {
|
|
56
|
-
devices: [],
|
|
57
|
-
xpert: devices.filter(d => d.attributes.xpert).length > 0
|
|
58
|
-
}
|
|
59
|
-
|
|
60
65
|
const sliced = automaticReports.sliceArray(devices, sliceSize)
|
|
61
66
|
|
|
62
67
|
let deviceCount = 0
|