fleetmap-reports 1.0.601 → 1.0.603

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.601",
3
+ "version": "1.0.603",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -66,7 +66,8 @@ function processDevices (from, to, devices, data, userData) {
66
66
  }
67
67
  }
68
68
 
69
- stop.stopDuration = ((new Date(stop.endTime) - new Date(stop.startTime)) - stop.engineHours)
69
+ const totalStopTime = new Date(stop.endTime) - new Date(stop.startTime)
70
+ stop.stopDuration = totalStopTime > stop.engineHours ? (totalStopTime - stop.engineHours) : 0
70
71
  })
71
72
 
72
73
  if (deviceStops.length > 0) {
@@ -5,7 +5,6 @@ const utils = require('../util/utils')
5
5
 
6
6
  // eslint-disable-next-line no-undef
7
7
  describe('Test_Reports', function () {
8
- this.timeout(5000000)
9
8
  it('converts to pdf', async () => {
10
9
  const report = await getReports()
11
10
  const userData = await report.getUserData()
@@ -444,7 +444,7 @@ function exportTripReportToExcel (userData, reportData) {
444
444
  distance: Number(a.totalKms.toFixed(1)),
445
445
  averageSpeed: Math.round(a.averageSpeed * 1.85200),
446
446
  maxSpeed: Math.round(a.maxSpeed * 1.85200),
447
- consumption: a.fuelConsumption.toFixed(1),
447
+ consumption: a.fuelConsumption && a.fuelConsumption.toFixed(1),
448
448
  avgConsumption: a.avgFuelConsumption.toFixed(1),
449
449
  subname: userData.byDriver ? a.deviceName : getDriverName(userData.drivers, a.driverUniqueId)
450
450
  }