fleetmap-reports 1.0.774 → 1.0.775
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
|
@@ -124,13 +124,13 @@ function getDeviceData (allInOne, d) {
|
|
|
124
124
|
economicDistance
|
|
125
125
|
}
|
|
126
126
|
} else {
|
|
127
|
-
const deviceSummary = allInOne.summary.filter(t => t.deviceId === d.id)
|
|
127
|
+
const deviceSummary = allInOne.summary.filter(t => t.deviceId === d.id)[0]
|
|
128
128
|
|
|
129
129
|
const drivingTime = deviceTrips.reduce((a, b) => a + b.duration, 0)
|
|
130
130
|
const drivingConsumption = deviceTrips.reduce((a, b) => a + b.spentFuel, 0)
|
|
131
|
-
const drivingDistance = deviceSummary
|
|
132
|
-
const idleTime = deviceSummary
|
|
133
|
-
const idleConsumption = deviceSummary
|
|
131
|
+
const drivingDistance = deviceSummary ? deviceSummary.distance / 1000 : 0
|
|
132
|
+
const idleTime = deviceSummary && deviceSummary.engineHours > drivingTime ? deviceSummary.engineHours - drivingTime : 0
|
|
133
|
+
const idleConsumption = deviceSummary && deviceSummary.spentFuel > drivingConsumption ? deviceSummary.spentFuel - drivingConsumption : 0
|
|
134
134
|
|
|
135
135
|
const hardBreaking = deviceRoute.filter(p => p.attributes.io253 === 2).length
|
|
136
136
|
const hardAcceleration = deviceRoute.filter(p => p.attributes.io253 === 1).length
|