fleetmap-reports 1.0.368 → 1.0.369
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/kms-report.js +10 -6
package/package.json
CHANGED
package/src/kms-report.js
CHANGED
|
@@ -9,6 +9,7 @@ const {getDates, convertFromUTC} = require("./util/utils")
|
|
|
9
9
|
const trips = require("./util/trips")
|
|
10
10
|
const drivers = require("./util/driver")
|
|
11
11
|
const { isInsideTimetable, isPartialInsideTimetable, calculateTrip} = require("./util/trips")
|
|
12
|
+
const traccarHelper = require("./util/traccar");
|
|
12
13
|
|
|
13
14
|
const fileName = 'KmsReport'
|
|
14
15
|
|
|
@@ -46,14 +47,15 @@ async function createKmsReportByDevice(from, to, userData, traccarInstance) {
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
devicesToProcess.sort((a, b) => (a.name > b.name) ? 1 : -1)
|
|
49
|
-
const
|
|
50
|
-
const tripsData =
|
|
50
|
+
const allInOne = await traccarHelper.getAllInOne(traccarInstance, from, to, devicesToProcess, true, true, false, false)
|
|
51
|
+
const tripsData = allInOne.trips
|
|
52
|
+
const routeData = allInOne.route
|
|
51
53
|
|
|
52
54
|
console.log('trips:' + tripsData.length)
|
|
53
55
|
|
|
54
56
|
if (tripsData.length > 0) {
|
|
55
|
-
trips.checkTripsKms(traccarInstance, from, to, devicesToProcess, {trips: tripsData, route:
|
|
56
|
-
allData.devices = processDevices(from, to, devicesToProcess, {trips: tripsData, route:
|
|
57
|
+
trips.checkTripsKms(traccarInstance, from, to, devicesToProcess, {trips: tripsData, route: routeData})
|
|
58
|
+
allData.devices = processDevices(from, to, devicesToProcess, {trips: tripsData, route: routeData}, userData)
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
return allData
|
|
@@ -68,8 +70,10 @@ async function createKmsReportByDriver(from, to, userData, traccarInstance) {
|
|
|
68
70
|
return { drivers: [] }
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
+
const allInOne = await traccarHelper.getAllInOne(traccarInstance, from, to, devices, true, true, false, false)
|
|
74
|
+
const tripsData = allInOne.trips
|
|
75
|
+
const routeData = allInOne.route
|
|
76
|
+
|
|
73
77
|
|
|
74
78
|
return { drivers: processDrivers(from, to, userData, {trips: tripsData, route: routeData}) }
|
|
75
79
|
}
|