fleetmap-reports 1.0.933 → 1.0.935

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.933",
3
+ "version": "1.0.935",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -35,22 +35,22 @@ function getDeviceData (allInOne, d, user, minDistance) {
35
35
  return deviceRoute.map((pA, index) => {
36
36
  if (index < deviceRoute.length - 1) {
37
37
  const pB = deviceRoute[index + 1]
38
- let distanceValue = pA.distance
39
- if ((minDistance * 1000) >= pA.distance) {
40
- distanceValue = distance.default([pA.longitude, pA.latitude], [pB.longitude, pB.latitude], { units: 'meters' })
41
- }
42
-
43
- return {
44
- device: d.name,
45
- dateA: convertToLocaleString(pA.fixTime, user.attributes.lang, user.attributes.timezone, user),
46
- addressA: pA.address,
47
- dateB: convertToLocaleString(pB.fixTime, user.attributes.lang, user.attributes.timezone, user),
48
- addressB: pB.address,
49
- distance: distanceValue
38
+ if ((minDistance * 1000) < pB.distance) {
39
+ const distanceValue = distance.default([pA.longitude, pA.latitude], [pB.longitude, pB.latitude], { units: 'meters' })
40
+ if ((minDistance * 1000) < distanceValue) {
41
+ return {
42
+ device: d.name,
43
+ dateA: convertToLocaleString(pA.fixTime, user.attributes.lang, user.attributes.timezone, user),
44
+ addressA: pA.address,
45
+ dateB: convertToLocaleString(pB.fixTime, user.attributes.lang, user.attributes.timezone, user),
46
+ addressB: pB.address,
47
+ distance: distanceValue
48
+ }
49
+ }
50
50
  }
51
51
  }
52
52
  return undefined
53
- }).filter(a => a && (minDistance * 1000) < a.distance)
53
+ }).filter(a => a)
54
54
  }
55
55
 
56
56
  exports.createGPSJumpReport = createGPSJumpReport