fleetmap-reports 1.0.948 → 1.0.950
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 +1 -1
- package/src/speeding-report.js +1 -1
- package/src/util/trips.js +1 -3
package/package.json
CHANGED
package/src/speeding-report.js
CHANGED
|
@@ -306,7 +306,7 @@ function getCountry (position) {
|
|
|
306
306
|
|
|
307
307
|
async function getRoadSpeedLimits (devices, routes, threshold, minimumMinutes = 0) {
|
|
308
308
|
const position = routes.find(p => getCountry(p))
|
|
309
|
-
const country = getCountry(position)
|
|
309
|
+
const country = position && getCountry(position)
|
|
310
310
|
const config = {
|
|
311
311
|
CHL: getOSMSpeedingEvents,
|
|
312
312
|
MAR: getOSMSpeedingEvents,
|
package/src/util/trips.js
CHANGED
|
@@ -138,8 +138,8 @@ function isInsideTimetable (t, userData) {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
function updateTrip (device, t, route) {
|
|
141
|
-
if (!route[route.length - 1]) { return }
|
|
142
141
|
route = route.filter(p => p.attributes.ignition)
|
|
142
|
+
if (!route.length) { return }
|
|
143
143
|
const distance = calculateDistance(route, false) * 1000
|
|
144
144
|
t.distance = distance
|
|
145
145
|
t.duration = new Date(route[route.length - 1].fixTime).getTime() - new Date(route[0].fixTime).getTime()
|
|
@@ -147,8 +147,6 @@ function updateTrip (device, t, route) {
|
|
|
147
147
|
t.averageSpeed = distance > 0 ? ((route.reduce((a, b) => a + b.speed, 0)) / route.length) : 0
|
|
148
148
|
t.startOdometer = !device.attributes['report.ignoreOdometer'] && route[0].attributes.odometer ? route[0].attributes.odometer : route[0].attributes.totalDistance
|
|
149
149
|
t.endOdometer = !device.attributes['report.ignoreOdometer'] && route[route.length - 1].attributes.odometer ? route[route.length - 1].attributes.odometer : route[route.length - 1].attributes.totalDistance
|
|
150
|
-
console.log('startOdometer', t.startOdometer)
|
|
151
|
-
console.log('endOdometer', t.endOdometer)
|
|
152
150
|
}
|
|
153
151
|
|
|
154
152
|
function getUncompletedTrip (device, deviceRoute, deviceTrips) {
|