fleetmap-reports 1.0.767 → 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.767",
3
+ "version": "1.0.768",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -65,17 +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)
76
-
77
- drivingData.used = (totalTime > 0 ? drivingTime * 100 / totalTime : 0).toFixed(0)
78
- idleData.used = (totalTime > 0 ? idleTime * 100 / totalTime : 0).toFixed(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)
79
95
 
80
96
  reportData.push(totalData)
81
97
  reportData.push(drivingData)
@@ -103,7 +119,7 @@ function getDeviceXpertData (allInOne, d) {
103
119
  return { endTripData, canDriverStyle }
104
120
  }
105
121
 
106
- function getRowData (index, device, description, time, consumption, distance, indicator) {
122
+ function getRowData (index, device, description, time, consumption, distance, indicator, use, rpm, cruiseControl) {
107
123
  return {
108
124
  index,
109
125
  device: device.name,
@@ -111,7 +127,10 @@ function getRowData (index, device, description, time, consumption, distance, in
111
127
  time,
112
128
  consumption,
113
129
  distance,
114
- indicator
130
+ indicator,
131
+ use,
132
+ rpm,
133
+ cruiseControl
115
134
  }
116
135
  }
117
136