fleetmap-reports 2.0.250 → 2.0.252
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/util/utils.js +7 -2
- package/src/zone-report.js +2 -2
package/package.json
CHANGED
package/src/util/utils.js
CHANGED
|
@@ -296,8 +296,13 @@ exports.convertToFeature = convertToFeature
|
|
|
296
296
|
exports.convertPositionToFeature = convertPositionToFeature
|
|
297
297
|
exports.calculateDistance = (positions, ignoreOdometer) => {
|
|
298
298
|
let distanceValue = 0
|
|
299
|
-
if (!ignoreOdometer &&
|
|
300
|
-
|
|
299
|
+
if (!ignoreOdometer &&
|
|
300
|
+
positions.length > 1 &&
|
|
301
|
+
positions[0].attributes &&
|
|
302
|
+
positions[0].attributes.odometer &&
|
|
303
|
+
positions[positions.length - 1].attributes &&
|
|
304
|
+
positions[positions.length - 1].attributes.odometer) {
|
|
305
|
+
distanceValue = (positions[positions.length - 1].attributes.odometer - positions[0].attributes.odometer) / 1000
|
|
301
306
|
}
|
|
302
307
|
|
|
303
308
|
if (distanceValue > 0) {
|
package/src/zone-report.js
CHANGED
|
@@ -120,7 +120,7 @@ async function createZoneReport (from, to, userData, traccar) {
|
|
|
120
120
|
reportRangeDays
|
|
121
121
|
}, { timeout: 900000 })
|
|
122
122
|
.catch(e => {
|
|
123
|
-
console.error(url, e.message
|
|
123
|
+
console.error(url, (e.message && e.response.data) || e, 'try again')
|
|
124
124
|
return traccar.axios.post(url, {
|
|
125
125
|
from,
|
|
126
126
|
to,
|
|
@@ -477,7 +477,7 @@ function analyseAlerts (alerts, deviceRoute, userData, from, to, device) {
|
|
|
477
477
|
anyLastExit: a.anyLastExit,
|
|
478
478
|
geofenceName: geofence.name,
|
|
479
479
|
geofenceId: geofence.id,
|
|
480
|
-
stopped: routeIn.filter(p => !p.attributes
|
|
480
|
+
stopped: routeIn.filter(p => !(p.attributes && p.attributes.ignition)).length > 0,
|
|
481
481
|
driverName: inData.position.driverName
|
|
482
482
|
})
|
|
483
483
|
zoneInData = zoneInData.filter(z => z.geofenceId !== a.geofenceId)
|