fleetmap-reports 2.0.266 → 2.0.268
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/location-report.js +22 -19
- package/src/speeding-report.js +1 -1
package/package.json
CHANGED
package/src/location-report.js
CHANGED
|
@@ -41,8 +41,26 @@ async function createLocationReport (from, to, userData, traccar) {
|
|
|
41
41
|
return reportData
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
async function
|
|
45
|
-
|
|
44
|
+
async function createLocationReportByDriver (from, to, userData, traccar) {
|
|
45
|
+
// server side only
|
|
46
|
+
const url = `http://${process.env.TRACCAR_HOST}/api/devices`
|
|
47
|
+
const devices = await traccar.axios.get(url).then(d => d.data)
|
|
48
|
+
console.log(devices.length)
|
|
49
|
+
|
|
50
|
+
if (!devices.length) {
|
|
51
|
+
// Empty report
|
|
52
|
+
return { drivers: [] }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const sliced = automaticReports.sliceArray(devices, 1)
|
|
56
|
+
const deviceCount = 0
|
|
57
|
+
const promises = sliced.map(slice => _getDriverRoute(traccar, from, to, slice, deviceCount, devices, userData))
|
|
58
|
+
const result = await Promise.all(promises)
|
|
59
|
+
return { drivers: result.flat() }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function _getDriverRoute (traccar, from, to, slice, deviceCount, devices, userData) {
|
|
63
|
+
const url = `https://${getDriverRoute.env.SERVER_HOST}/pinmeapi/process-report/get-driver-route'`
|
|
46
64
|
return traccar.axios.post(url, {
|
|
47
65
|
from,
|
|
48
66
|
to,
|
|
@@ -53,7 +71,7 @@ async function _process (traccar, from, to, slice, deviceCount, devices, userDat
|
|
|
53
71
|
}).then(d => d.data)
|
|
54
72
|
}
|
|
55
73
|
|
|
56
|
-
async function
|
|
74
|
+
async function getDriverRoute (traccar, from, to, slice, deviceCount, devices, userData) {
|
|
57
75
|
const allInOne = await traccarHelper.getAllInOne(
|
|
58
76
|
traccar, from, to, slice, true, false, false, false,
|
|
59
77
|
deviceCount,
|
|
@@ -67,21 +85,6 @@ async function process (traccar, from, to, slice, deviceCount, devices, userData
|
|
|
67
85
|
await processDrivers(from, to, userData, allInOne)
|
|
68
86
|
}
|
|
69
87
|
|
|
70
|
-
async function createLocationReportByDriver (from, to, userData, traccar) {
|
|
71
|
-
// server side only
|
|
72
|
-
const url = `http://${process.env.TRACCAR_HOST}/api/devices`
|
|
73
|
-
const devices = await traccar.axios.get(url).then(d => d.data)
|
|
74
|
-
console.log(devices.length)
|
|
75
|
-
|
|
76
|
-
if (!devices.length) { return { drivers: [] } }
|
|
77
|
-
|
|
78
|
-
const sliced = automaticReports.sliceArray(devices, 1)
|
|
79
|
-
const deviceCount = 0
|
|
80
|
-
const promises = sliced.map(slice => _process(traccar, from, to, slice, deviceCount, devices, userData))
|
|
81
|
-
const result = await Promise.all(promises)
|
|
82
|
-
return { drivers: result.flat() }
|
|
83
|
-
}
|
|
84
|
-
|
|
85
88
|
async function createLocationReportByGroup (from, to, userData, traccar) {
|
|
86
89
|
const reportData = []
|
|
87
90
|
|
|
@@ -493,4 +496,4 @@ exports.create = createLocationReport
|
|
|
493
496
|
exports.exportToPDF = exportLocationReportToPDF
|
|
494
497
|
exports.exportToExcel = exportLocationReportToExcel
|
|
495
498
|
exports.getDigitalPortValue = getDigitalPortValue
|
|
496
|
-
exports.
|
|
499
|
+
exports.getDriverRoute = getDriverRoute
|
package/src/speeding-report.js
CHANGED
|
@@ -79,7 +79,7 @@ function processServerSide () {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
async function getOverspeedEvents (from, to, userData, devices, allData, traccarInstance) {
|
|
82
|
-
const _sliced = automaticReports.sliceArray(automaticReports.sliceArray(devices,
|
|
82
|
+
const _sliced = automaticReports.sliceArray(automaticReports.sliceArray(devices, 4), 4)
|
|
83
83
|
let deviceCount = 0
|
|
84
84
|
const overspeedEvents = []
|
|
85
85
|
for (const sliced of _sliced) {
|