fleetmap-reports 1.0.315 → 1.0.316

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.315",
3
+ "version": "1.0.316",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -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 => {
@@ -110,7 +110,7 @@ function processDevices(from, to, devices, routes) {
110
110
  if(idleEvents.length) {
111
111
  const deviceData = {
112
112
  device: d,
113
- idleEvents: idleEvents
113
+ idleEvents: idleEvents.filter(e => userData.minimumIdleMinutes ? e.idleTime > userData.minimumIdleMinutes*60*1000 : true)
114
114
  }
115
115
  devicesResult.push(deviceData)
116
116
  }