fleetmap-reports 2.0.259 → 2.0.261
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 +9 -6
package/package.json
CHANGED
package/src/location-report.js
CHANGED
|
@@ -42,7 +42,8 @@ async function createLocationReport (from, to, userData, traccar) {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
async function createLocationReportByDriver (from, to, userData, traccar) {
|
|
45
|
-
|
|
45
|
+
// server side only
|
|
46
|
+
const url = `http://${process.env.TRACCAR_HOST}/api/devices`
|
|
46
47
|
const devices = await traccar.axios.get(url).then(d => d.data)
|
|
47
48
|
console.log(devices.length)
|
|
48
49
|
|
|
@@ -51,9 +52,13 @@ async function createLocationReportByDriver (from, to, userData, traccar) {
|
|
|
51
52
|
return { drivers: [] }
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
const
|
|
55
|
+
const sliced = automaticReports.sliceArray(devices, 5)
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
for (const slice of sliced) {
|
|
58
|
+
const allInOne = await traccarHelper.getAllInOne(traccar, from, to, slice, true, false, false, false)
|
|
59
|
+
await processDrivers(from, to, userData, allInOne)
|
|
60
|
+
}
|
|
61
|
+
return { drivers: driversResult }
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
async function createLocationReportByGroup (from, to, userData, traccar) {
|
|
@@ -159,9 +164,9 @@ function processDevices (from, to, devices, data) {
|
|
|
159
164
|
|
|
160
165
|
return devicesResult
|
|
161
166
|
}
|
|
167
|
+
const driversResult = []
|
|
162
168
|
|
|
163
169
|
async function processDrivers (from, to, userData, data) {
|
|
164
|
-
const driversResult = []
|
|
165
170
|
for (const d of userData.drivers) {
|
|
166
171
|
const { route } = await getDriverData(d, data, userData)
|
|
167
172
|
if (route.length > 0) {
|
|
@@ -184,8 +189,6 @@ async function processDrivers (from, to, userData, data) {
|
|
|
184
189
|
}
|
|
185
190
|
}
|
|
186
191
|
console.log(driversResult)
|
|
187
|
-
|
|
188
|
-
return driversResult
|
|
189
192
|
}
|
|
190
193
|
|
|
191
194
|
async function exportLocationReportToPDF (userData, reportData) {
|