fleetmap-reports 1.0.908 → 1.0.910
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
package/src/kms-report.js
CHANGED
|
@@ -175,6 +175,8 @@ function processDevices (from, to, devices, data, userData) {
|
|
|
175
175
|
|
|
176
176
|
devicesResult.push({
|
|
177
177
|
device: d,
|
|
178
|
+
startOdometer: trips.length ? trips[0].startOdometer : 0,
|
|
179
|
+
endOdometer: trips.length ? trips[trips.length - 1].endOdometer : 0,
|
|
178
180
|
days
|
|
179
181
|
})
|
|
180
182
|
}
|
|
@@ -182,6 +184,8 @@ function processDevices (from, to, devices, data, userData) {
|
|
|
182
184
|
devicesResult.push({
|
|
183
185
|
device: d,
|
|
184
186
|
summary: {
|
|
187
|
+
startOdometer: trips.length ? trips[0].startOdometer : 0,
|
|
188
|
+
endOdometer: trips.length ? trips[trips.length - 1].endOdometer : 0,
|
|
185
189
|
distance: trips.filter(t => t.distance > 0).reduce((a, b) => a + b.distance, 0)
|
|
186
190
|
}
|
|
187
191
|
})
|
|
@@ -321,14 +325,16 @@ function exportKmsReportToExcel (userData, reportData) {
|
|
|
321
325
|
headers.push(
|
|
322
326
|
{ label: translations.report.vehicle, value: 'name' },
|
|
323
327
|
{ label: translations.settings.vehicle_licenseplate, value: 'licenseplate' },
|
|
324
|
-
{ label: translations.report.group, value: 'group' }
|
|
328
|
+
{ label: translations.report.group, value: 'group' },
|
|
329
|
+
{ label: translations.report.startOdometer, value: 'startOdometer' })
|
|
325
330
|
|
|
326
331
|
const days = info[0].days
|
|
327
332
|
days.forEach((day, index) => {
|
|
328
333
|
headers.push({ label: new Date(day.date).toLocaleDateString(), value: 'day' + index })
|
|
329
334
|
})
|
|
330
335
|
|
|
331
|
-
headers.push({ label: translations.report.total, value: 'total' }
|
|
336
|
+
headers.push({ label: translations.report.total, value: 'total' },
|
|
337
|
+
{ label: translations.report.endOdometer, value: 'endOdometer' })
|
|
332
338
|
} else if (userData.byDriver) {
|
|
333
339
|
headers.push(
|
|
334
340
|
{ label: translations.report.driver, value: 'name' },
|
|
@@ -354,7 +360,9 @@ function exportKmsReportToExcel (userData, reportData) {
|
|
|
354
360
|
const vehicle = {
|
|
355
361
|
name: d.device.name,
|
|
356
362
|
group: group ? group.name : '',
|
|
357
|
-
licenseplate: d.device.attributes.license_plate
|
|
363
|
+
licenseplate: d.device.attributes.license_plate,
|
|
364
|
+
startOdometer: Number((d.startOdometer / 1000).toFixed(1)),
|
|
365
|
+
endOdometer: Number((d.endOdometer / 1000).toFixed(1))
|
|
358
366
|
}
|
|
359
367
|
|
|
360
368
|
d.days.forEach((day, index) => {
|
|
@@ -29,7 +29,7 @@ async function createPerformanceReport (from, to, userData, traccar) {
|
|
|
29
29
|
const device = userData.devices[0]
|
|
30
30
|
|
|
31
31
|
const {
|
|
32
|
-
drivingTime, idleTime, cruiseControlTime, economicTime, highEngineRPM,
|
|
32
|
+
drivingTime, idleTime, cruiseControlTime, economicTime, highEngineRPM, hardBraking, hardAcceleration, hardCornering,
|
|
33
33
|
drivingConsumption, idleConsumption, cruiseControlConsumption, economicConsumption, drivingDistance, cruiseControlDistance,
|
|
34
34
|
economicDistance
|
|
35
35
|
} = getDeviceData(allInOne, device)
|
|
@@ -43,8 +43,9 @@ async function createPerformanceReport (from, to, userData, traccar) {
|
|
|
43
43
|
const economicIndicator = (totalTime > 0 ? economicTime * 100 / totalTime : 0).toFixed(1) + ' %'
|
|
44
44
|
const cruiseControlIndicator = (totalTime > 0 ? cruiseControlTime * 100 / totalTime : 0).toFixed(1) + ' %'
|
|
45
45
|
const highEngineRPMIndicator = (totalTime > 0 ? highEngineRPM * 100 / totalTime : 0).toFixed(1) + ' %'
|
|
46
|
-
const
|
|
46
|
+
const hardBrakingIndicator = (drivingDistance > 0 ? hardBraking * 100 / drivingDistance : 0).toFixed(0) + ' Freinage/100 Km'
|
|
47
47
|
const hardAccelerationIndicator = (drivingDistance > 0 ? hardAcceleration * 100 / drivingDistance : 0).toFixed(0) + ' Accélération/100 Km'
|
|
48
|
+
const hardCorneringIndicator = (drivingDistance > 0 ? hardCornering * 100 / drivingDistance : 0).toFixed(0) + ' Virages/100 Km'
|
|
48
49
|
|
|
49
50
|
const drivingUse = Math.round(totalTime > 0 ? drivingTime * 100 / totalTime : 0)
|
|
50
51
|
const idleUse = Math.round(totalTime > 0 ? idleTime * 100 / totalTime : 0)
|
|
@@ -62,8 +63,9 @@ async function createPerformanceReport (from, to, userData, traccar) {
|
|
|
62
63
|
const economicData = getRowData(4, device, 'Économique', economicTime, economicConsumption, economicDistance, economicIndicator, 0, engineEconomicRPM, 0)
|
|
63
64
|
const cruiseControlData = getRowData(5, device, 'Cruise Control', cruiseControlTime, cruiseControlConsumption, cruiseControlDistance, cruiseControlIndicator, 0, 0, cruiseControlOn)
|
|
64
65
|
const highEngineRPMData = getRowData(6, device, 'Tour moteur élevé', highEngineRPM, '', '', highEngineRPMIndicator, 0, engineHighRPM, 0)
|
|
65
|
-
const
|
|
66
|
+
const hardBrakingData = getRowData(7, device, 'Freinage brusque', hardBraking, '', '', hardBrakingIndicator, 0, 0, 0)
|
|
66
67
|
const hardAccelerationData = getRowData(8, device, 'Accéleration brusque', hardAcceleration, '', '', hardAccelerationIndicator, 0, 0, 0)
|
|
68
|
+
const hardCorneringData = getRowData(9, device, 'Virages brusque', hardCornering, '', '', hardCorneringIndicator, 0, 0, 0)
|
|
67
69
|
|
|
68
70
|
reportData.push(totalData)
|
|
69
71
|
reportData.push(drivingData)
|
|
@@ -71,8 +73,9 @@ async function createPerformanceReport (from, to, userData, traccar) {
|
|
|
71
73
|
reportData.push(economicData)
|
|
72
74
|
reportData.push(cruiseControlData)
|
|
73
75
|
reportData.push(highEngineRPMData)
|
|
74
|
-
reportData.push(
|
|
76
|
+
reportData.push(hardBrakingData)
|
|
75
77
|
reportData.push(hardAccelerationData)
|
|
78
|
+
reportData.push(hardCorneringData)
|
|
76
79
|
}
|
|
77
80
|
return reportData
|
|
78
81
|
}
|
|
@@ -96,8 +99,9 @@ function getDeviceData (allInOne, d) {
|
|
|
96
99
|
const cruiseControlTime = endTripData.length > 1 ? endTripData[endTripData.length - 1].totalTimeWithCruiseControl - endTripData[0].totalTimeWithCruiseControl : 0
|
|
97
100
|
const economicTime = canDriverStyle.length > 1 ? canDriverStyle[canDriverStyle.length - 1].totalTimeInEcoRange - canDriverStyle[0].totalTimeInEcoRange : 0
|
|
98
101
|
const highEngineRPM = canDriverStyle.length > 1 ? canDriverStyle[canDriverStyle.length - 1].totalTimeWithHighRpmAndTorque - canDriverStyle[0].totalTimeWithHighRpmAndTorque : 0
|
|
99
|
-
const
|
|
102
|
+
const hardBraking = canDriverStyle.length > 1 ? canDriverStyle[canDriverStyle.length - 1].totalNumberOfHarshBrakes - canDriverStyle[0].totalNumberOfHarshBrakes : 0
|
|
100
103
|
const hardAcceleration = canDriverStyle.length > 1 ? canDriverStyle[canDriverStyle.length - 1].totalNumberOfHarshAccelerations - canDriverStyle[0].totalNumberOfHarshAccelerations : 0
|
|
104
|
+
const hardCornering = 0
|
|
101
105
|
|
|
102
106
|
const drivingConsumption = endTripData.length > 1 ? (endTripData[endTripData.length - 1].totalFuelConsumptionDriving - endTripData[0].totalFuelConsumptionDriving) * 0.1 : 0
|
|
103
107
|
const idleConsumption = endTripData.length > 1 ? (endTripData[endTripData.length - 1].totalFuelConsumptionInIdle - endTripData[0].totalFuelConsumptionInIdle) * 0.1 : 0
|
|
@@ -114,8 +118,9 @@ function getDeviceData (allInOne, d) {
|
|
|
114
118
|
cruiseControlTime,
|
|
115
119
|
economicTime,
|
|
116
120
|
highEngineRPM,
|
|
117
|
-
|
|
121
|
+
hardBraking,
|
|
118
122
|
hardAcceleration,
|
|
123
|
+
hardCornering,
|
|
119
124
|
drivingConsumption,
|
|
120
125
|
idleConsumption,
|
|
121
126
|
cruiseControlConsumption,
|
|
@@ -150,8 +155,9 @@ function getDeviceData (allInOne, d) {
|
|
|
150
155
|
? a[a.length - 1].attributes.fuelUsed - a[0].attributes.fuelUsed
|
|
151
156
|
: 0).reduce((a, b) => a + (b || 0), 0)
|
|
152
157
|
|
|
153
|
-
const
|
|
158
|
+
const hardBraking = deviceRoute.filter(p => p.attributes.alarm === 'hardBraking').length
|
|
154
159
|
const hardAcceleration = deviceRoute.filter(p => p.attributes.alarm === 'hardAcceleration').length
|
|
160
|
+
const hardCornering = deviceRoute.filter(p => p.attributes.alarm === 'hardCornering').length
|
|
155
161
|
|
|
156
162
|
return {
|
|
157
163
|
drivingTime: drivingTime / 1000,
|
|
@@ -159,8 +165,9 @@ function getDeviceData (allInOne, d) {
|
|
|
159
165
|
cruiseControlTime: 0,
|
|
160
166
|
economicTime: economicTime / 1000,
|
|
161
167
|
highEngineRPM: highEngineRPM / 1000,
|
|
162
|
-
|
|
168
|
+
hardBraking,
|
|
163
169
|
hardAcceleration,
|
|
170
|
+
hardCornering,
|
|
164
171
|
drivingConsumption,
|
|
165
172
|
idleConsumption,
|
|
166
173
|
cruiseControlConsumption: 0,
|