fleetmap-reports 2.0.301 → 2.0.303
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/location-report.js +2 -1
- package/src/trip-report.js +2 -2
- package/src/util/trips.js +2 -2
package/package.json
CHANGED
package/src/location-report.js
CHANGED
|
@@ -73,7 +73,7 @@ async function createLocationReportByDriver (from, to, userData, traccar) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
async function _getDriverRoute (traccar, from, to, slice, deviceCount, devices, userData, retry = 3) {
|
|
76
|
-
const url =
|
|
76
|
+
const url = 'https://rntba7aqifqx3iywrenb7pq6km0liwsr.lambda-url.us-east-1.on.aws/pinmeapi/process-report/get-driver-route'
|
|
77
77
|
return traccar.axios.post(url, {
|
|
78
78
|
from,
|
|
79
79
|
to,
|
|
@@ -189,6 +189,7 @@ async function processDrivers (from, to, userData, data) {
|
|
|
189
189
|
const result = []
|
|
190
190
|
for (const d of userData.drivers) {
|
|
191
191
|
const { route } = await getDriverData(d, data, userData)
|
|
192
|
+
|
|
192
193
|
if (route.length > 0) {
|
|
193
194
|
route.sort((a, b) => new Date(a.fixTime).getTime() - new Date(b.fixTime).getTime())
|
|
194
195
|
|
package/src/trip-report.js
CHANGED
|
@@ -222,7 +222,7 @@ async function processDevices (from, to, devices, data, userData, traccar) {
|
|
|
222
222
|
|
|
223
223
|
if (stop && !trip.endTimeIsOut) {
|
|
224
224
|
trip.stopDuration = calculateStopDuration(stop)
|
|
225
|
-
trip.stopEngineHours = trip.idleTime + stop.
|
|
225
|
+
trip.stopEngineHours = trip.idleTime + stop.idleTime
|
|
226
226
|
} else {
|
|
227
227
|
trip.stopDuration = 0
|
|
228
228
|
trip.stopEngineHours = 0
|
|
@@ -292,7 +292,7 @@ async function processDrivers (from, to, userData, data) {
|
|
|
292
292
|
trip.endPOIName = nearestPOIs[0].p.name
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
trip.stopEngineHours = getTripIdleTime(trip, idleEvents) + (stop ? stop.
|
|
295
|
+
trip.stopEngineHours = getTripIdleTime(trip, idleEvents) + (stop ? stop.idleTime : 0)
|
|
296
296
|
})
|
|
297
297
|
|
|
298
298
|
if (trips.length > 0) {
|
package/src/util/trips.js
CHANGED
|
@@ -192,8 +192,8 @@ function getTripIdleTime (trip, idleEvents) {
|
|
|
192
192
|
|
|
193
193
|
function calculateStopDuration (stop) {
|
|
194
194
|
const totalStopTime = new Date(stop.endTime) - new Date(stop.startTime)
|
|
195
|
-
if (totalStopTime < stop.
|
|
196
|
-
return totalStopTime - (stop.
|
|
195
|
+
if (totalStopTime < stop.idleTime) return 0
|
|
196
|
+
return totalStopTime - (stop.idleTime > 0 ? stop.idleTime : 0)
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
const maxDistanceDiff = 10000
|