fleetmap-reports 1.0.664 → 1.0.665

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/zone-report.js +12 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.664",
3
+ "version": "1.0.665",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -262,6 +262,18 @@ function analyseAlertsGroupGeofences (alerts, deviceRoute, from, to) {
262
262
  totalTime: totalInTime
263
263
  })
264
264
  }
265
+
266
+ if (zoneInOutData.length > 0) {
267
+ if (zoneInOutData[0].inTime) {
268
+ // Add distanceOut before the first entry
269
+ const routeOut = deviceRoute.filter(p =>
270
+ new Date(p.fixTime).getTime() < new Date(zoneInOutData[0].inTime.fixTime).getTime() &&
271
+ new Date(p.fixTime).getTime() <= to.getTime()
272
+ )
273
+ zoneInOutData[0].distanceOut = calculateDistance(routeOut)
274
+ }
275
+ }
276
+
265
277
  return zoneInOutData
266
278
  }
267
279