fleetmap-reports 2.0.111 → 2.0.112

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.111",
3
+ "version": "2.0.112",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -12,7 +12,7 @@ const traccarHelper = require('./util/traccar')
12
12
  const trips = require('./util/trips')
13
13
  const {
14
14
  isInsideTimetable, isPartialInsideTimetable, getTripIdleTime, calculateStopDuration,
15
- getUncompletedTrip
15
+ getUncompletedTrip, getTripTotalKms
16
16
  } = require('./util/trips')
17
17
  const { devicesToProcess, deviceName } = require('./util/device')
18
18
  const { getIdleEvents } = require('./util/route')
@@ -311,11 +311,6 @@ async function processDrivers (from, to, userData, data) {
311
311
  return driversResult
312
312
  }
313
313
 
314
- function getTripTotalKms (trip, stop) {
315
- // 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
316
- return (trip.distance + (stop ? (stop.endOdometer - stop.startOdometer) : 0)) / 1000
317
- }
318
-
319
314
  async function exportTripReportToPDF (userData, reportData) {
320
315
  console.log('exportTripReportToPDF')
321
316
 
package/src/util/trips.js CHANGED
@@ -217,6 +217,11 @@ function calculateStopDuration (stop) {
217
217
  return totalStopTime - (stop.engineHours > 0 ? stop.engineHours : 0)
218
218
  }
219
219
 
220
+ function getTripTotalKms (trip, stop) {
221
+ // 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
222
+ return (trip.distance + (stop ? (stop.endOdometer - stop.startOdometer) : 0)) / 1000
223
+ }
224
+
220
225
  exports.checkTripsKms = checkTripsKms
221
226
  exports.isInsideTimetable = isInsideTimetable
222
227
  exports.isPartialInsideTimetable = isPartialInsideTimetable
@@ -227,3 +232,4 @@ exports.calculateTrip = calculateTrip
227
232
  exports.getTripIdleTime = getTripIdleTime
228
233
  exports.calculateStopDuration = calculateStopDuration
229
234
  exports.getUncompletedTrip = getUncompletedTrip
235
+ exports.getTripTotalKms = getTripTotalKms