fleetmap-reports 1.0.792 → 1.0.793
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/activity-report.js +7 -8
package/package.json
CHANGED
package/src/activity-report.js
CHANGED
|
@@ -74,16 +74,15 @@ async function createActivityReportByGroup (from, to, userData, traccarInstance)
|
|
|
74
74
|
return reportData
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
async function executeServerSide (allData, sliced, from, to, userData) {
|
|
78
|
-
|
|
77
|
+
async function executeServerSide (allData, sliced, from, to, userData, totalDevices) {
|
|
78
|
+
let deviceCount = 0
|
|
79
79
|
for (const devices of sliced) {
|
|
80
80
|
const url = `https://${process.env.SERVER_HOST}/reports/activity-report`
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
})
|
|
81
|
+
const data = await axios.post(url, { from, to, userData: { ...userData, devices } }, { withCredentials: true }).then(d => d.data)
|
|
82
|
+
allData.devices.push(...(data[0].devices))
|
|
83
|
+
deviceCount = deviceCount + devices.length
|
|
84
|
+
console.log(`PROGRESS_PERC:${deviceCount / totalDevices * 100}`)
|
|
85
85
|
}
|
|
86
|
-
await Promise.all(requests)
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
async function createActivityReportByDevice (from, to, userData, traccarInstance) {
|
|
@@ -97,7 +96,7 @@ async function createActivityReportByDevice (from, to, userData, traccarInstance
|
|
|
97
96
|
}
|
|
98
97
|
|
|
99
98
|
if (isClientSide() && allDevices.length > 200) {
|
|
100
|
-
const sliced = automaticReports.sliceArray(allDevices,
|
|
99
|
+
const sliced = automaticReports.sliceArray(allDevices, 50)
|
|
101
100
|
await executeServerSide(allData, sliced, from, to, userData, allDevices.length)
|
|
102
101
|
} else {
|
|
103
102
|
let deviceCount = 0
|