fleetmap-reports 1.0.994 → 1.0.997
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/trip-report.js +19 -17
package/package.json
CHANGED
package/src/trip-report.js
CHANGED
|
@@ -268,29 +268,31 @@ async function processDrivers (from, to, userData, data) {
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
for (const d of userData.drivers) {
|
|
271
|
-
const { trips } = getDriverData(d, data)
|
|
271
|
+
const { trips } = await getDriverData(d, data, userData)
|
|
272
272
|
|
|
273
|
-
trips
|
|
274
|
-
|
|
273
|
+
if (trips) {
|
|
274
|
+
trips.forEach(trip => {
|
|
275
|
+
trip.totalKms = trip.distance / 1000
|
|
275
276
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
277
|
+
const nearestPOIs = getNearestPOIs(trip.endLon, trip.endLat, userData.geofences)
|
|
278
|
+
if (nearestPOIs.length > 0) {
|
|
279
|
+
trip.endPOIName = nearestPOIs[0].p.name
|
|
280
|
+
}
|
|
280
281
|
|
|
281
|
-
|
|
282
|
+
const stop = data.stops.find(s => s.deviceId === trip.deviceId && (new Date(s.startTime).getTime() === new Date(trip.endTime).getTime()))
|
|
282
283
|
|
|
283
|
-
|
|
284
|
-
|
|
284
|
+
trip.stopEngineHours = getTripIdleTime(trip, idleEvents) + (stop ? stop.engineHours : 0)
|
|
285
|
+
})
|
|
285
286
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
287
|
+
if (trips.length > 0) {
|
|
288
|
+
const driverData = {
|
|
289
|
+
driver: d,
|
|
290
|
+
from,
|
|
291
|
+
to,
|
|
292
|
+
trips
|
|
293
|
+
}
|
|
294
|
+
driversResult.push(driverData)
|
|
292
295
|
}
|
|
293
|
-
driversResult.push(driverData)
|
|
294
296
|
}
|
|
295
297
|
}
|
|
296
298
|
|