fleetmap-reports 1.0.705 → 1.0.707

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.705",
3
+ "version": "1.0.707",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -35,8 +35,8 @@
35
35
  "eslint-plugin-node": "^11.1.0",
36
36
  "eslint-plugin-promise": "^6.0.0",
37
37
  "jest": "^27.5.0",
38
- "mocha": "^9.0.3",
39
- "webpack": "^5.24.3",
38
+ "mocha": "^10.2.0",
39
+ "webpack": "^5.51.0",
40
40
  "webpack-cli": "^4.5.0"
41
41
  }
42
42
  }
@@ -206,7 +206,7 @@ function findPOIData (event, userData) {
206
206
  }
207
207
 
208
208
  function findGeofenceData (event, userData) {
209
- const geofence = userData.geofences.filter(g => g && !g.area.startsWith('CIRCLE')).find(g =>
209
+ const geofence = userData.geofences.filter(g => !g.area.startsWith('CIRCLE')).find(g =>
210
210
  checkGeofenceIn(convertPositionToFeature(event.position), convertToFeature(g)))
211
211
  if (geofence) {
212
212
  const group = userData.groups.find(g => g.geofenceIds && g.geofenceIds.includes(geofence.id))
@@ -1,5 +1,4 @@
1
1
  const { getReports } = require('./index')
2
- const assert = require('assert')
3
2
  // eslint-disable-next-line no-undef
4
3
  describe('idle', function () {
5
4
  // eslint-disable-next-line no-undef
@@ -17,10 +17,12 @@ describe('Test_Reports', function () {
17
17
  userData)
18
18
  await report.speedingReportToPDF(userData, data)
19
19
  }, 40000)
20
+
20
21
  it('converts madrid time', async () => {
21
22
  assert.equal(false, utils.isClientSide())
22
23
  console.log(utils.convertToLocaleString(new Date(), 'es-CL', 'Europe/Madrid'))
23
24
  })
25
+
24
26
  // eslint-disable-next-line no-undef
25
27
  it('Trip by device', async () => {
26
28
  const report = await getReports()
@@ -1,6 +1,5 @@
1
1
  const { getReports } = require('./index')
2
2
  const assert = require('assert')
3
- const ellca = require('./ellca.json')
4
3
  // eslint-disable-next-line no-undef
5
4
  describe('zones', function () {
6
5
  // eslint-disable-next-line no-undef
@@ -20,6 +19,7 @@ describe('zones', function () {
20
19
  console.log('result', result)
21
20
  }, 4000000)
22
21
 
22
+ // eslint-disable-next-line no-undef
23
23
  it('works with afriquia', async () => {
24
24
  const report = await getReports('moviflotte@gmail.com', 'moviflotte@gmail.com')
25
25
  const userData = await report.getUserData()
@@ -75,7 +75,7 @@ async function createZoneReport (from, to, userData, traccar) {
75
75
  deviceCount, devices.length, sliceSize, deviceChunk, undefined)
76
76
 
77
77
  const route = filterPositions(data.route)
78
- const alerts = getInAndOutEvents(slice, route, userData)
78
+ const alerts = await getInAndOutEvents(slice, route, userData)
79
79
 
80
80
  allData.devices.push(...await processDevices(from, to, devices, userData, { alerts, route }))
81
81
 
@@ -300,11 +300,11 @@ function analyseAlerts (alerts, deviceRoute, userData, from, to) {
300
300
  return zoneInOutData
301
301
  }
302
302
 
303
- function getInAndOutEvents (devices, route, userData) {
303
+ async function getInAndOutEvents (devices, route, userData) {
304
304
  const events = []
305
305
  const geofencesFeatures = userData.geofences.map(g => convertToFeature(g))
306
306
 
307
- devices.forEach(d => {
307
+ await Promise.all(devices.map(async d => {
308
308
  const deviceRoute = route.filter(p => p.deviceId === d.id)
309
309
  const routePoints = deviceRoute.sort(sortPositions).map(p => convertPositionToFeature(p))
310
310
  const deviceEvents = []
@@ -336,7 +336,7 @@ function getInAndOutEvents (devices, route, userData) {
336
336
  })
337
337
  })
338
338
  events.push(...deviceEvents)
339
- })
339
+ }))
340
340
  return events
341
341
  }
342
342