fleetmap-reports 1.0.864 → 1.0.866
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 +4 -3
package/package.json
CHANGED
package/src/speeding-report.js
CHANGED
|
@@ -303,7 +303,8 @@ async function getRoadSpeedLimits (devices, routes, threshold, minimumMinutes =
|
|
|
303
303
|
const position = routes[0]
|
|
304
304
|
const country = crg.get_country(position.latitude, position.longitude)
|
|
305
305
|
const config = {
|
|
306
|
-
CHL: getOSMSpeedingEvents
|
|
306
|
+
CHL: getOSMSpeedingEvents,
|
|
307
|
+
MAR: getOSMSpeedingEvents
|
|
307
308
|
}
|
|
308
309
|
const method = config[country && country.code] || getHereEvents
|
|
309
310
|
return method(devices, routes, threshold, minimumMinutes)
|
|
@@ -352,11 +353,11 @@ async function getOSMSpeedingEvents (devices, routes, threshold, minimumMinutes
|
|
|
352
353
|
}
|
|
353
354
|
const reduced = results.reduce((acc, cur, idx, src) => {
|
|
354
355
|
const last = acc.length && acc.slice(-1)[0]
|
|
355
|
-
if (last && new Date(cur.fixTime) - new Date(src[idx - 1]) < 1000 * 60 * 2) {
|
|
356
|
+
if (last && new Date(cur.fixTime) - new Date(src[idx - 1].fixTime) < 1000 * 60 * 2) {
|
|
356
357
|
last.eventTime = new Date(cur.fixTime) - new Date(last.fixTime)
|
|
357
358
|
last.attributes.maxSpeed = Math.max(last.attributes.maxSpeed, cur.speed)
|
|
358
359
|
last.distance += distance.default(point([cur.longitude, cur.latitude]), point([src[idx - 1].longitude, src[idx - 1].latitude]))
|
|
359
|
-
} else
|
|
360
|
+
} else {
|
|
360
361
|
cur.positionId = cur && cur.id
|
|
361
362
|
cur.roadSpeedLimit = cur.speed_limit
|
|
362
363
|
cur.deviceId = d.id
|