fleetmap-reports 1.0.480 → 1.0.482
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 +9 -10
package/package.json
CHANGED
package/src/speeding-report.js
CHANGED
|
@@ -233,9 +233,17 @@ async function findEventsPosition (from, to, devices, events, routes, userData)
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
if (!userData.roadSpeedLimits) {
|
|
236
|
+
console.log('ignorting eventdata')
|
|
236
237
|
a.position = positions[pIndex]
|
|
237
238
|
calculateEventData(positions, pIndex, a, d, geofence, userData)
|
|
238
239
|
}
|
|
240
|
+
if (a.position.attributes.driverUniqueId) {
|
|
241
|
+
const driver = userData.drivers.find(d => d.uniqueId === a.position.attributes.driverUniqueId)
|
|
242
|
+
a.driver = (driver && driver.name) || a.position.attributes.driverUniqueId
|
|
243
|
+
}
|
|
244
|
+
a.deviceName = d.name
|
|
245
|
+
|
|
246
|
+
return pIndex
|
|
239
247
|
}
|
|
240
248
|
}
|
|
241
249
|
}
|
|
@@ -287,7 +295,7 @@ async function getHereEvents (devices, routes, threshold) {
|
|
|
287
295
|
if (cur.currentSpeedKmh > parseInt(cur.speedLimit) + (threshold || 0)) {
|
|
288
296
|
cur.position = positions.find(p => new Date(p.fixTime).getTime() === cur.timestamp)
|
|
289
297
|
if (previous && previous.speedLimit === cur.speedLimit) {
|
|
290
|
-
previous.eventTime
|
|
298
|
+
previous.eventTime = cur.timestamp - previous.timestamp
|
|
291
299
|
previous.attributes.maxSpeed = Math.max(previous.attributes.maxSpeed, cur.position.speed)
|
|
292
300
|
previous.distance += distance.default(point([cur.position.longitude, cur.position.latitude]), point([previous.position.longitude, previous.position.latitude]))
|
|
293
301
|
} else {
|
|
@@ -337,15 +345,6 @@ function calculateEventData (positions, pIndex, alert, device, geofence, userDat
|
|
|
337
345
|
}
|
|
338
346
|
}
|
|
339
347
|
}
|
|
340
|
-
|
|
341
|
-
if (alert.position.attributes.driverUniqueId) {
|
|
342
|
-
const driver = userData.drivers.find(d => d.uniqueId === alert.position.attributes.driverUniqueId)
|
|
343
|
-
alert.driver = driver && driver.name
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
alert.deviceName = device.name
|
|
347
|
-
|
|
348
|
-
return pIndex
|
|
349
348
|
}
|
|
350
349
|
|
|
351
350
|
async function exportSpeedingReportToPDF (userData, reportData) {
|