fleetmap-reports 1.0.766 → 1.0.768

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.766",
3
+ "version": "1.0.768",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -65,14 +65,33 @@ 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(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)
68
+ const totalIndicator = (drivingDistance > 0 ? (totalConsumption * 0.1) * 100 / drivingDistance : 0).toFixed(1) + ' L/100'
69
+ const drivingIndicator = (drivingDistance > 0 ? (drivingConsumption * 0.1) * 100 / drivingDistance : 0).toFixed(1) + ' L/100'
70
+ const idleIndicator = (totalConsumption > 0 ? idleConsumption * 100 / totalConsumption : 0).toFixed(1) + ' %'
71
+ const economicIndicator = (totalTime > 0 ? economicTime * 100 / totalTime : 0).toFixed(1) + ' %'
72
+ const cruiseControlIndicator = (totalTime > 0 ? cruiseControlTime * 100 / totalTime : 0).toFixed(1) + ' %'
73
+ const highEngineRPMIndicator = (totalTime > 0 ? highEngineRPM * 100 / totalTime : 0).toFixed(1) + ' %'
74
+ const hardBreakingIndicator = (drivingDistance > 0 ? hardBreaking * 100 / drivingDistance : 0).toFixed(0) + ' Freinage/100 Km'
75
+ const hardAccelerationIndicator = (drivingDistance > 0 ? hardAcceleration * 100 / drivingDistance : 0).toFixed(0) + ' Accélération/100 Km'
76
+
77
+ const drivingUse = Math.round(totalTime > 0 ? drivingTime * 100 / totalTime : 0)
78
+ const idleUse = Math.round(totalTime > 0 ? idleTime * 100 / totalTime : 0)
79
+
80
+ const engineEconomicRPM = Math.round(totalTime > 0 ? economicTime * 100 / totalTime : 0)
81
+ const engineHighRPM = Math.round(totalTime > 0 ? highEngineRPM * 100 / totalTime : 0)
82
+ const engineOtherRPM = 100 - (engineEconomicRPM + engineHighRPM)
83
+
84
+ const cruiseControlOn = Math.round(totalTime > 0 ? cruiseControlTime * 100 / totalTime : 0)
85
+ const cruiseControlOff = 100 - cruiseControlOn
86
+
87
+ const totalData = getRowData(1, device, 'Totale', totalTime, totalConsumption, drivingDistance, totalIndicator, 0, 0, 0)
88
+ const drivingData = getRowData(2, device, 'Conduite', drivingTime, drivingConsumption, drivingDistance, drivingIndicator, drivingUse, engineOtherRPM, cruiseControlOff)
89
+ const idleData = getRowData(3, device, 'Ralenti', idleTime, idleConsumption, '', idleIndicator, idleUse, 0, 0)
90
+ const economicData = getRowData(4, device, 'Économique', economicTime, economicConsumption, economicDistance, economicIndicator, 0, engineEconomicRPM, 0)
91
+ const cruiseControlData = getRowData(5, device, 'Cruise Control', cruiseControlTime, cruiseControlConsumption, cruiseControlDistance, cruiseControlIndicator, 0, 0, cruiseControlOn)
92
+ const highEngineRPMData = getRowData(6, device, 'Tour moteur élevé', highEngineRPM, '', '', highEngineRPMIndicator, 0, engineHighRPM, 0)
93
+ const hardBreakingData = getRowData(7, device, 'Freinage brusque', hardBreaking, '', '', hardBreakingIndicator, 0, 0, 0)
94
+ const hardAccelerationData = getRowData(8, device, 'Accéleration brusque', hardAcceleration, '', '', hardAccelerationIndicator, 0, 0, 0)
76
95
 
77
96
  reportData.push(totalData)
78
97
  reportData.push(drivingData)
@@ -100,15 +119,18 @@ function getDeviceXpertData (allInOne, d) {
100
119
  return { endTripData, canDriverStyle }
101
120
  }
102
121
 
103
- function getRowData (index, device, description, time, consumption, economicDistance, totalTime) {
122
+ function getRowData (index, device, description, time, consumption, distance, indicator, use, rpm, cruiseControl) {
104
123
  return {
105
124
  index,
106
125
  device: device.name,
107
126
  description,
108
127
  time,
109
128
  consumption,
110
- distance: economicDistance,
111
- indicator: totalTime > 0 ? time * 100 / totalTime : 0
129
+ distance,
130
+ indicator,
131
+ use,
132
+ rpm,
133
+ cruiseControl
112
134
  }
113
135
  }
114
136