fleetmap-reports 1.0.399 → 1.0.400
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/index.test.js +3 -1
- package/src/util/utils.js +1 -1
- package/src/zone-report.js +1 -1
package/package.json
CHANGED
package/src/index.test.js
CHANGED
|
@@ -48,6 +48,8 @@ describe('Test_Reports', function () {
|
|
|
48
48
|
assert.equal(data.length, 1)
|
|
49
49
|
const device = data[0].devices.find(d => d.device.id === 22326)
|
|
50
50
|
assert.equal(device.trips.length, 7) // Total Trips
|
|
51
|
+
assert.equal(device.trips[0].endPOIName, 'Casa João')
|
|
52
|
+
assert.equal(device.trips[1].endPOIName, undefined)
|
|
51
53
|
assert.equal(device.totalDistance, 339204.53999999166) // Total Kms
|
|
52
54
|
}, 20000)
|
|
53
55
|
// eslint-disable-next-line no-undef
|
|
@@ -271,7 +273,7 @@ describe('Test_Reports', function () {
|
|
|
271
273
|
assert.equal(tripsReport.length, 1)
|
|
272
274
|
const device1 = tripsReport[0].devices.find(d => d.device.id === 11681)
|
|
273
275
|
assert.equal(device1.trips.length, 44) // Total Trips
|
|
274
|
-
assert.equal(device1.totalDistance,
|
|
276
|
+
assert.equal(device1.totalDistance, 882801.0815308811) // Total Kms
|
|
275
277
|
|
|
276
278
|
const device2 = kmsReport[0].devices.find(d => d.device.id === 11681)
|
|
277
279
|
assert.equal(device2.summary.distance, device1.totalDistance) // Total Kms
|
package/src/util/utils.js
CHANGED
|
@@ -32,7 +32,7 @@ function coordsDistance (lon1, lat1, lon2, lat2) {
|
|
|
32
32
|
const from = turf.point([lon1, lat1])
|
|
33
33
|
const to = turf.point([lon2, lat2])
|
|
34
34
|
|
|
35
|
-
return distance.default(from, to, 'meters')
|
|
35
|
+
return distance.default(from, to, {units: 'meters'})
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function convertPositionToFeature (position) {
|
package/src/zone-report.js
CHANGED
|
@@ -175,7 +175,7 @@ function getInAndOutEvents(devices, route, userData) {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
if(g.geometry.type === 'Point') {
|
|
178
|
-
if (distance(p, g, 'meters') < g.properties.distance) {
|
|
178
|
+
if (distance(p, g, {units: 'meters'}) < g.properties.distance) {
|
|
179
179
|
if (!entryMap.includes(g)) {
|
|
180
180
|
events.push(createEvent('geofenceEnter',d.id,p,g))
|
|
181
181
|
entryMap.push(g)
|