fleetmap-reports 2.0.115 → 2.0.116

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.115",
3
+ "version": "2.0.116",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/util/trips.js CHANGED
@@ -191,7 +191,8 @@ function calculateStopDuration (stop) {
191
191
  function getTripTotalKms (trip, stop, route) {
192
192
  // 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
193
193
  let distance = trip.distance + (stop ? (stop.endOdometer - stop.startOdometer) : 0)
194
- if (!distance && route && route.length) {
194
+ if (!trip.distance && route && route.length) {
195
+ distance = 0
195
196
  const positions = route.filter(p => p.deviceId === trip.deviceId &&
196
197
  new Date(p.fixTime).getTime() >= new Date(trip.startTime).getTime() &&
197
198
  new Date(p.fixTime).getTime() <= new Date(trip.endTime).getTime())