fleetmap-reports 1.0.315 → 1.0.320
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/events-report.js +1 -1
- package/src/idle-report.js +7 -5
- package/src/kms-report.js +1 -1
- package/src/speeding-report.js +1 -1
package/package.json
CHANGED
package/src/events-report.js
CHANGED
|
@@ -25,7 +25,7 @@ async function createEventsReport(from, to, userData, traccar) {
|
|
|
25
25
|
xpert: devices.filter(d => d.attributes.xpert).length > 0
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const data = await getReportData(from, to, devices, userData.eventTypes)
|
|
28
|
+
const data = await getReportData(from, to, devices, userData.eventTypes, traccar)
|
|
29
29
|
|
|
30
30
|
devices.sort((a, b) => (a.name > b.name) ? 1 : -1)
|
|
31
31
|
|
package/src/idle-report.js
CHANGED
|
@@ -45,7 +45,7 @@ async function createTripReportByGroup(from, to, userData, traccarInstance) {
|
|
|
45
45
|
|
|
46
46
|
if (routes.length > 0) {
|
|
47
47
|
console.log('Routes:' + routes.length)
|
|
48
|
-
groupData.devices = processDevices(from, to, devices, routes)
|
|
48
|
+
groupData.devices = processDevices(from, to, devices, routes, userData)
|
|
49
49
|
|
|
50
50
|
reportData.push(groupData)
|
|
51
51
|
}
|
|
@@ -76,13 +76,13 @@ async function createTripReportByDevice(from, to, devices, userData, traccarInst
|
|
|
76
76
|
console.log('Route:' + route.length)
|
|
77
77
|
|
|
78
78
|
if (route.length > 0) {
|
|
79
|
-
allData.devices = processDevices(from, to, devices, route)
|
|
79
|
+
allData.devices = processDevices(from, to, devices, route, userData)
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
return allData
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
function processDevices(from, to, devices, routes) {
|
|
85
|
+
function processDevices(from, to, devices, routes, userData) {
|
|
86
86
|
const devicesResult = []
|
|
87
87
|
|
|
88
88
|
devices.forEach(d => {
|
|
@@ -107,10 +107,12 @@ function processDevices(from, to, devices, routes) {
|
|
|
107
107
|
}
|
|
108
108
|
})
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
const filteredEvents = idleEvents.filter(e => userData.minimumIdleMinutes ? e.idleTime > userData.minimumIdleMinutes*60*1000 : true)
|
|
111
|
+
|
|
112
|
+
if(filteredEvents.length) {
|
|
111
113
|
const deviceData = {
|
|
112
114
|
device: d,
|
|
113
|
-
idleEvents:
|
|
115
|
+
idleEvents: filteredEvents
|
|
114
116
|
}
|
|
115
117
|
devicesResult.push(deviceData)
|
|
116
118
|
}
|
package/src/kms-report.js
CHANGED
|
@@ -103,7 +103,7 @@ async function createKmsReportByGroup(from, to, userData, traccarInstance) {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
const withoutGroupData = await createKmsReportByDevice(from, to)
|
|
106
|
+
const withoutGroupData = await createKmsReportByDevice(from, to, userData, traccarInstance)
|
|
107
107
|
reportData.push(withoutGroupData)
|
|
108
108
|
|
|
109
109
|
return reportData
|
package/src/speeding-report.js
CHANGED
|
@@ -63,7 +63,7 @@ async function createSpeedingReportByGroup(from, to, userData, traccarInstance){
|
|
|
63
63
|
const groupIds = userData.groups.map(g => g.id)
|
|
64
64
|
const withoutGroupDevices = userData.devices.filter(d => !groupIds.includes(d.groupId))
|
|
65
65
|
|
|
66
|
-
const withoutGroupData = await createSpeedingReportByDevice(from, to, withoutGroupDevices)
|
|
66
|
+
const withoutGroupData = await createSpeedingReportByDevice(from, to, withoutGroupDevices, userData, traccarInstance)
|
|
67
67
|
reportData.push(withoutGroupData)
|
|
68
68
|
|
|
69
69
|
return reportData
|