fleetmap-reports 2.0.46 → 2.0.48
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 +4 -13
- package/src/speeding-report.js +1 -1
- package/src/util/utils.js +4 -2
package/package.json
CHANGED
package/src/activity-report.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const automaticReports = require('./automaticReports')
|
|
2
2
|
const {
|
|
3
3
|
convertMS, getDates, getTranslations, weekDaySelected, convertToLocaleString, isClientSide,
|
|
4
|
-
getLanguage
|
|
4
|
+
getLanguage, executeServerSide
|
|
5
5
|
} = require('./util/utils')
|
|
6
6
|
const jsPDF = require('jspdf')
|
|
7
7
|
require('jspdf-autotable')
|
|
@@ -75,17 +75,6 @@ async function createActivityReportByGroup (from, to, userData, traccarInstance)
|
|
|
75
75
|
return reportData
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
async function executeServerSide (allData, sliced, from, to, userData, totalDevices, { axios }) {
|
|
79
|
-
let deviceCount = 0
|
|
80
|
-
for (const devices of sliced) {
|
|
81
|
-
const url = `https://${process.env.SERVER_HOST}/reports/activity-report`
|
|
82
|
-
const data = await axios.post(url, { from, to, userData: { ...userData, devices } }, { withCredentials: true }).then(d => d.data)
|
|
83
|
-
allData.devices.push(...(data[0].devices))
|
|
84
|
-
deviceCount = deviceCount + devices.length
|
|
85
|
-
console.log(`PROGRESS_PERC:${deviceCount / totalDevices * 100}`)
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
78
|
async function createActivityReportByDevice (from, to, userData, traccarInstance) {
|
|
90
79
|
console.log('createActivityReportByDevice')
|
|
91
80
|
const allDevices = devicesToProcess(userData)
|
|
@@ -99,7 +88,9 @@ async function createActivityReportByDevice (from, to, userData, traccarInstance
|
|
|
99
88
|
|
|
100
89
|
if (isClientSide() && allDevices.length > 20) {
|
|
101
90
|
const sliced = automaticReports.sliceArray(allDevices, 10)
|
|
102
|
-
await executeServerSide(
|
|
91
|
+
await executeServerSide('activity-report', sliced, from, to, userData, allDevices.length, traccarInstance, 5).then(devices => {
|
|
92
|
+
allData.devices = devices
|
|
93
|
+
})
|
|
103
94
|
} else {
|
|
104
95
|
let summaryByDay = []
|
|
105
96
|
if (userData.allWeek && userData.groupByDay) {
|
package/src/speeding-report.js
CHANGED
|
@@ -385,7 +385,7 @@ async function invokeValhalla (route, i, chunk, country, threshold, results, ret
|
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
async function getOSMSpeedingEvents (devices, routes, threshold, minimumMinutes = 0, country) {
|
|
388
|
-
const chunk =
|
|
388
|
+
const chunk = 200
|
|
389
389
|
const events = []
|
|
390
390
|
for (const d of devices) {
|
|
391
391
|
const route = routes.filter(r => r.deviceId === d.id)
|
package/src/util/utils.js
CHANGED
|
@@ -243,11 +243,13 @@ async function executeServerSide (type, sliced, from, to, userData, totalItems,
|
|
|
243
243
|
userData: userData.byDriver
|
|
244
244
|
? {
|
|
245
245
|
...userData,
|
|
246
|
-
drivers: items
|
|
246
|
+
drivers: items,
|
|
247
|
+
geofences: []
|
|
247
248
|
}
|
|
248
249
|
: {
|
|
249
250
|
...userData,
|
|
250
|
-
devices: items
|
|
251
|
+
devices: items,
|
|
252
|
+
geofences: []
|
|
251
253
|
}
|
|
252
254
|
}, { withCredentials: true }).then(d => d.data)
|
|
253
255
|
reportData.push(...(userData.byDriver ? data[0].drivers : data[0].devices))
|