fleetmap-reports 1.0.456 → 1.0.459

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": "1.0.456",
3
+ "version": "1.0.459",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -330,6 +330,9 @@ function exportLocationReportToExcel (userData, reportData) {
330
330
  headers.push({ label: translations.report.temperature, value: 'temperature' })
331
331
  }
332
332
 
333
+ headers.push({ label: 'latitude', value: 'latitude' })
334
+ headers.push({ label: 'longitude', value: 'longitude' })
335
+
333
336
  let data = []
334
337
  if (positionsData) {
335
338
  if (userData.includeDigitalPorts) {
@@ -349,7 +352,9 @@ function exportLocationReportToExcel (userData, reportData) {
349
352
  driver: userData.byDriver ? d.driver.name : getDriverName(a, userData.drivers),
350
353
  temperature: getTempValue(a),
351
354
  digitalport1: getDigitalPortValue(a, 1, translations),
352
- digitalport2: getDigitalPortValue(a, 2, translations)
355
+ digitalport2: getDigitalPortValue(a, 2, translations),
356
+ latitude: a.latitude,
357
+ longitude: a.longitude
353
358
  }
354
359
  }))
355
360
  })
@@ -135,6 +135,9 @@ async function createTripReportByDriver (from, to, userData, traccar) {
135
135
  d.totalDistance = d.trips.reduce((a, b) => a + b.distance, 0)
136
136
  d.maxSpeed = d.trips.reduce((a, b) => { return a > b.maxSpeed ? a : b.maxSpeed }, 0)
137
137
  d.trips = d.trips.sort((a, b) => new Date(a.startTime).getTime() - new Date(b.startTime).getTime())
138
+ d.trips.forEach(function (trip, i) {
139
+ trip.stopDuration = i !== d.trips.length - 1 ? (new Date(d.trips[i + 1].startTime) - new Date(trip.endTime)) : 0
140
+ })
138
141
  })
139
142
 
140
143
  return report