fleetmap-reports 1.0.765 → 1.0.766

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.765",
3
+ "version": "1.0.766",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -65,14 +65,14 @@ async function createPerformanceReport (from, to, userData, traccar) {
65
65
  const totalTime = drivingTime + idleTime
66
66
  const totalConsumption = drivingConsumption + idleConsumption
67
67
 
68
- const totalData = getRowData(device, 'Totale', totalTime, totalConsumption, drivingDistance, drivingDistance > 0 ? totalConsumption * 100 / drivingDistance : 0)
69
- const drivingData = getRowData(device, 'Conduite', drivingTime, drivingConsumption, drivingDistance, drivingDistance > 0 ? drivingConsumption * 100 / drivingDistance : 0)
70
- const idleData = getRowData(device, 'Ralenti', idleTime, idleConsumption, '', totalConsumption > 0 ? idleConsumption * 100 / totalConsumption : 0)
71
- const economicData = getRowData(device, 'Économique', economicTime, economicConsumption, economicDistance, totalTime > 0 ? economicTime * 100 / totalTime : 0)
72
- const cruiseControlData = getRowData(device, 'Économique', cruiseControlTime, cruiseControlConsumption, cruiseControlDistance, totalTime > 0 ? cruiseControlTime * 100 / totalTime : 0)
73
- const highEngineRPMData = getRowData(device, 'Tour moteur élevé', highEngineRPM, '', '', totalTime > 0 ? highEngineRPM * 100 / totalTime : 0)
74
- const hardBreakingData = getRowData(device, 'Freinage brusque', hardBreaking, '', '', drivingDistance > 0 ? hardBreaking * 100 / drivingDistance : 0)
75
- const hardAccelerationData = getRowData(device, 'Accéleration brusque', hardAcceleration, '', '', drivingDistance > 0 ? hardAcceleration * 100 / drivingDistance : 0)
68
+ const totalData = getRowData(1, device, 'Totale', totalTime, totalConsumption, drivingDistance, (drivingDistance > 0 ? (totalConsumption * 0.1) * 100 / drivingDistance : 0).toFixed(1) + ' L/100')
69
+ const drivingData = getRowData(2, device, 'Conduite', drivingTime, drivingConsumption, drivingDistance, (drivingDistance > 0 ? (drivingConsumption * 0.1) * 100 / drivingDistance : 0).toFixed(1) + ' L/100')
70
+ const idleData = getRowData(3, device, 'Ralenti', idleTime, idleConsumption, '', (totalConsumption > 0 ? idleConsumption * 100 / totalConsumption : 0) + ' %')
71
+ const economicData = getRowData(4, device, 'Économique', economicTime, economicConsumption, economicDistance, totalTime > 0 ? economicTime * 100 / totalTime : 0)
72
+ const cruiseControlData = getRowData(5, device, 'Cruise Control', cruiseControlTime, cruiseControlConsumption, cruiseControlDistance, totalTime > 0 ? cruiseControlTime * 100 / totalTime : 0)
73
+ const highEngineRPMData = getRowData(6, device, 'Tour moteur élevé', highEngineRPM, '', '', totalTime > 0 ? highEngineRPM * 100 / totalTime : 0)
74
+ const hardBreakingData = getRowData(7, device, 'Freinage brusque', hardBreaking, '', '', drivingDistance > 0 ? hardBreaking * 100 / drivingDistance : 0)
75
+ const hardAccelerationData = getRowData(8, device, 'Accéleration brusque', hardAcceleration, '', '', drivingDistance > 0 ? hardAcceleration * 100 / drivingDistance : 0)
76
76
 
77
77
  reportData.push(totalData)
78
78
  reportData.push(drivingData)
@@ -100,8 +100,9 @@ function getDeviceXpertData (allInOne, d) {
100
100
  return { endTripData, canDriverStyle }
101
101
  }
102
102
 
103
- function getRowData (device, description, time, consumption, economicDistance, totalTime) {
103
+ function getRowData (index, device, description, time, consumption, economicDistance, totalTime) {
104
104
  return {
105
+ index,
105
106
  device: device.name,
106
107
  description,
107
108
  time,