fleetmap-reports 2.0.162 → 2.0.164

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.162",
3
+ "version": "2.0.164",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -19,6 +19,7 @@ function processDevices (from, to, devices, data, userData) {
19
19
  rows.push({
20
20
  startTime: currentStatus[s.sensor].startTime,
21
21
  endTime: positions[index - 1].fixTime,
22
+ endAddress: positions[index - 1].address,
22
23
  value: currentStatus[s.sensor].value,
23
24
  valueDescription: currentStatus[s.sensor].value ? d.attributes[s.sensor + 'on'] : d.attributes[s.sensor + 'off'],
24
25
  name: s.name,
package/src/util/trips.js CHANGED
@@ -217,7 +217,8 @@ function shouldRecalculate (trip, route) {
217
217
 
218
218
  function getTripTotalKms (trip, stop, route) {
219
219
  // we need to add stop kms to ensure that the total kms for the day, calculated with the odometer difference, will be equal to the sum of kms of all trips
220
- let distance = trip.distance + (stop ? (stop.endOdometer - stop.startOdometer) : 0)
220
+ const stopKms = stop && (stop.endOdometer - stop.startOdometer)
221
+ let distance = trip.distance + (stop && stopKms > 0 ? stopKms : 0)
221
222
  if (shouldRecalculate(trip, route)) {
222
223
  distance = 0
223
224
  const positions = route.filter(p => p.deviceId === trip.deviceId &&