fleetmap-reports 1.0.765 → 1.0.767

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.767",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -65,14 +65,17 @@ 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
+
77
+ drivingData.used = (totalTime > 0 ? drivingTime * 100 / totalTime : 0).toFixed(0)
78
+ idleData.used = (totalTime > 0 ? idleTime * 100 / totalTime : 0).toFixed(0)
76
79
 
77
80
  reportData.push(totalData)
78
81
  reportData.push(drivingData)
@@ -100,14 +103,15 @@ function getDeviceXpertData (allInOne, d) {
100
103
  return { endTripData, canDriverStyle }
101
104
  }
102
105
 
103
- function getRowData (device, description, time, consumption, economicDistance, totalTime) {
106
+ function getRowData (index, device, description, time, consumption, distance, indicator) {
104
107
  return {
108
+ index,
105
109
  device: device.name,
106
110
  description,
107
111
  time,
108
112
  consumption,
109
- distance: economicDistance,
110
- indicator: totalTime > 0 ? time * 100 / totalTime : 0
113
+ distance,
114
+ indicator
111
115
  }
112
116
  }
113
117