fleetmap-reports 1.0.278 → 1.0.279
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 +6 -3
package/package.json
CHANGED
package/src/speeding-report.js
CHANGED
|
@@ -237,10 +237,13 @@ async function getCustomSpeedLimitEvents(devices, routes){
|
|
|
237
237
|
async function getHereEvents(devices, routes, threshold){
|
|
238
238
|
console.log('here speed limit events')
|
|
239
239
|
const events = []
|
|
240
|
+
const hereData = {}
|
|
241
|
+
await Promise.all(devices.map(d =>
|
|
242
|
+
here.routeMatch(routes.filter(p => p.deviceId === d.id)).then(r => d.results = r)
|
|
243
|
+
))
|
|
240
244
|
for (const d of devices) {
|
|
241
|
-
const positions = routes.filter(p => p.deviceId === d.id)
|
|
242
245
|
try {
|
|
243
|
-
const results =
|
|
246
|
+
const results = d.results
|
|
244
247
|
const hereAlerts = results.filter(r => r.currentSpeedKmh > (parseInt(r.speedLimit) + threshold)).map(r => {
|
|
245
248
|
const position = positions.find(p => new Date(p.fixTime).getTime() === r.timestamp)
|
|
246
249
|
return {
|
|
@@ -263,7 +266,7 @@ async function getHereEvents(devices, routes, threshold){
|
|
|
263
266
|
})
|
|
264
267
|
events.push(...reduced)
|
|
265
268
|
} catch (e) {
|
|
266
|
-
|
|
269
|
+
console.error(e)
|
|
267
270
|
}
|
|
268
271
|
}
|
|
269
272
|
return events
|