fleetmap-reports 2.0.113 → 2.0.114

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": "2.0.113",
3
+ "version": "2.0.114",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -12,11 +12,6 @@ async function createGPSJumpReport (from, to, userData, traccar, minDistance) {
12
12
  for (const slice of sliced) {
13
13
  const allInOne = await traccarHelper.getAllInOne(traccar, from, to, slice, true, false, false, false, deviceCount, devices.length)
14
14
 
15
- allInOne.route.forEach(p => {
16
- p.distance = p.attributes.distance
17
- delete p.attributes
18
- })
19
-
20
15
  slice.forEach(d => {
21
16
  const deviceData = getDeviceData(allInOne, d, userData.user, minDistance || userData.minDistance)
22
17
  reportData = reportData.concat(deviceData)
@@ -34,17 +29,15 @@ function getDeviceData (allInOne, d, user, minDistance) {
34
29
  return deviceRoute.map((pA, index) => {
35
30
  if (index < deviceRoute.length - 1) {
36
31
  const pB = deviceRoute[index + 1]
37
- if ((minDistance * 1000) < pB.distance) {
38
- const distanceValue = distance.default([pA.longitude, pA.latitude], [pB.longitude, pB.latitude], { units: 'meters' })
39
- if ((minDistance * 1000) < distanceValue) {
40
- return {
41
- device: d.name,
42
- dateA: pA.fixTime,
43
- addressA: pA.address,
44
- dateB: pB.fixTime,
45
- addressB: pB.address,
46
- distance: distanceValue
47
- }
32
+ const distanceValue = distance.default([pA.longitude, pA.latitude], [pB.longitude, pB.latitude], { units: 'meters' })
33
+ if ((minDistance * 1000) < distanceValue) {
34
+ return {
35
+ device: d.name,
36
+ dateA: pA.fixTime,
37
+ addressA: pA.address,
38
+ dateB: pB.fixTime,
39
+ addressB: pB.address,
40
+ distance: distanceValue
48
41
  }
49
42
  }
50
43
  }