fleetmap-reports 1.0.755 → 1.0.756

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.755",
3
+ "version": "1.0.756",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -27,20 +27,20 @@ async function createPerformanceReport (from, to, userData, traccar) {
27
27
 
28
28
  const deviceData = {
29
29
  device: d.name,
30
- drivingTime: endTripData.reduce((a, b) => a + b.totalTimeDriving, 0),
31
- idleTime: endTripData.reduce((a, b) => a + b.totalTimeInIdle, 0),
32
- drivingConsumption: endTripData.reduce((a, b) => a + b.totalFuelConsumptionDriving, 0),
33
- idleConsumption: endTripData.reduce((a, b) => a + b.totalFuelConsumptionInIdle, 0),
34
- drivingDistance: endTripData.reduce((a, b) => a + b.totalDistanceTravelled, 0),
35
- cruiseControlTime: endTripData.reduce((a, b) => a + b.totalTimeWithCruiseControl, 0),
36
- cruiseControlConsumption: endTripData.reduce((a, b) => a + b.totalFuelConsumptionWithCruiseControl, 0),
37
- cruiseControlDistance: endTripData.reduce((a, b) => a + b.totalDistanceTravelledWithCruiseControl, 0),
38
- economicTime: canDriverStyle.reduce((a, b) => a + b.totalTimeInEcoRange, 0),
39
- economicConsumption: canDriverStyle.reduce((a, b) => a + b.totalFuelConsumptionInEcoRange, 0),
40
- economicDistance: canDriverStyle.reduce((a, b) => a + b.totalDistanceInEcoRange, 0),
41
- highEngineRPM: canDriverStyle.reduce((a, b) => a + b.totalTimeWithHighRpmAndTorque, 0),
42
- hardBreaking: canDriverStyle.reduce((a, b) => a + b.totalNumberOfHarshBrakes, 0),
43
- hardAcceleration: canDriverStyle.reduce((a, b) => a + b.totalNumberOfHarshAccelerations, 0)
30
+ drivingTime: endTripData.length > 1 ? endTripData[endTripData.length - 1].totalTimeDriving - endTripData[0].totalTimeDriving : 0,
31
+ idleTime: endTripData.length > 1 ? endTripData[endTripData.length - 1].totalTimeInIdle - endTripData[0].totalTimeInIdle : 0,
32
+ drivingConsumption: endTripData.length > 1 ? endTripData[endTripData.length - 1].totalFuelConsumptionDriving - endTripData[0].totalFuelConsumptionDriving : 0,
33
+ idleConsumption: endTripData.length > 1 ? endTripData[endTripData.length - 1].totalFuelConsumptionInIdle - endTripData[0].totalFuelConsumptionInIdle : 0,
34
+ drivingDistance: endTripData.length > 1 ? endTripData[endTripData.length - 1].totalDistanceTravelled - endTripData[0].totalDistanceTravelled : 0,
35
+ cruiseControlTime: endTripData.length > 1 ? endTripData[endTripData.length - 1].totalTimeWithCruiseControl - endTripData[0].totalTimeWithCruiseControl : 0,
36
+ cruiseControlConsumption: endTripData.length > 1 ? endTripData[endTripData.length - 1].totalFuelConsumptionWithCruiseControl - endTripData[0].totalFuelConsumptionWithCruiseControl : 0,
37
+ cruiseControlDistance: endTripData.length > 1 ? endTripData[endTripData.length - 1].totalDistanceTravelledWithCruiseControl - endTripData[0].totalDistanceTravelledWithCruiseControl : 0,
38
+ economicTime: canDriverStyle.length > 1 ? canDriverStyle[canDriverStyle.length - 1].totalTimeInEcoRange - canDriverStyle[0].totalTimeInEcoRange : 0,
39
+ economicConsumption: canDriverStyle.length > 1 ? canDriverStyle[canDriverStyle.length - 1].totalFuelConsumptionInEcoRange - canDriverStyle[0].totalFuelConsumptionInEcoRange : 0,
40
+ economicDistance: canDriverStyle.length > 1 ? canDriverStyle[canDriverStyle.length - 1].totalDistanceInEcoRange - canDriverStyle[0].totalDistanceInEcoRange : 0,
41
+ highEngineRPM: canDriverStyle.length > 1 ? canDriverStyle[canDriverStyle.length - 1].totalTimeWithHighRpmAndTorque - canDriverStyle[0].totalTimeWithHighRpmAndTorque : 0,
42
+ hardBreaking: canDriverStyle.length > 1 ? canDriverStyle[canDriverStyle.length - 1].totalNumberOfHarshBrakes - canDriverStyle[0].totalNumberOfHarshBrakes : 0,
43
+ hardAcceleration: canDriverStyle.length > 1 ? canDriverStyle[canDriverStyle.length - 1].totalNumberOfHarshAccelerations - canDriverStyle[0].totalNumberOfHarshAccelerations : 0
44
44
  }
45
45
  reportData.push(deviceData)
46
46
  })