fleetmap-reports 1.0.841 → 1.0.843

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.841",
3
+ "version": "1.0.843",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -2,8 +2,10 @@ const automaticReports = require('../automaticReports')
2
2
  const traccarHelper = require('../util/traccar')
3
3
  const distance = require('@turf/distance')
4
4
 
5
+ const minDistance = 5000
6
+
5
7
  async function createGPSJumpReport (from, to, userData, traccar) {
6
- const reportData = []
8
+ let reportData = []
7
9
 
8
10
  const devices = userData.devices
9
11
 
@@ -14,7 +16,7 @@ async function createGPSJumpReport (from, to, userData, traccar) {
14
16
 
15
17
  slice.forEach(d => {
16
18
  const deviceData = getDeviceData(allInOne, d)
17
- reportData.push(...deviceData)
19
+ reportData = reportData.concat(deviceData)
18
20
  })
19
21
 
20
22
  deviceCount = deviceCount + slice.length
@@ -33,15 +35,15 @@ function getDeviceData (allInOne, d) {
33
35
 
34
36
  return {
35
37
  device: d.name,
36
- dateA: pA.fixTime,
38
+ dateA: new Date(pA.fixTime),
37
39
  addressA: pA.address,
38
- dateB: pB.fixTime,
40
+ dateB: new Date(pB.fixTime),
39
41
  addressB: pB.address,
40
42
  distance: distanceValue
41
43
  }
42
44
  }
43
45
  return undefined
44
- }).filter(a => a)
46
+ }).filter(a => a && minDistance < a.distance)
45
47
  }
46
48
 
47
49
  exports.createGPSJumpReport = createGPSJumpReport