fleetmap-reports 1.0.738 → 1.0.739

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.738",
3
+ "version": "1.0.739",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,6 +1,10 @@
1
1
  const moment = require('moment')
2
2
 
3
- function sliceArray (longArray, size = 1) {
3
+ const maxParallelRequests = 25
4
+ function sliceArray (longArray, size) {
5
+ if (!size) {
6
+ size = (longArray.length / maxParallelRequests) + 1
7
+ }
4
8
  const arrayToSlice = longArray.slice()
5
9
 
6
10
  const arrayOfArrays = []
@@ -2,7 +2,6 @@ const { getReports } = require('./index')
2
2
  const { createPerformanceReport } = require('../partnerReports/performance-report')
3
3
  // eslint-disable-next-line no-undef
4
4
  describe('performance', function () {
5
- this.timeout(500000)
6
5
  // eslint-disable-next-line no-undef
7
6
  it('performance report', async () => {
8
7
  const report = await getReports()
@@ -2,7 +2,6 @@ const { getReports } = require('./index')
2
2
  const assert = require('assert')
3
3
  // eslint-disable-next-line no-undef
4
4
  describe('zones', function () {
5
- this.timeout(500000)
6
5
  // eslint-disable-next-line no-undef
7
6
  it('works with ellca', async () => {
8
7
  const report = await getReports()
@@ -48,25 +47,4 @@ describe('zones', function () {
48
47
  assert.equal(first.inTime.fixTime, '2023-01-03T21:23:24.000+0000')
49
48
  assert.equal(first.outTime.fixTime, '2023-01-07T12:22:53.000+0000')
50
49
  }, 4000000)
51
-
52
- // eslint-disable-next-line no-undef
53
- it('works with casais 2', async () => {
54
- const report = await getReports('mario.andre.moreira@casais.gi', 'Casais.23')
55
- const userData = await report.getUserData()
56
- userData.groupByDay = true
57
- userData.devices = userData.devices.filter(d => d.name === 'G-2542-F Fiat Tipo')
58
- userData.geofences = userData.geofences.filter(g => g.name === 'baliza raio verde ')
59
- assert.equal(userData.geofences.length > 0, true)
60
- assert.equal(userData.devices.length > 0, true)
61
- const result = await report.zoneReport(
62
- new Date(2023, 1, 27, 0, 0, 0, 0),
63
- new Date(2023, 1, 27, 23, 59, 59, 0),
64
- userData)
65
- assert.equal(result[0].devices[0].geofences.length, 1)
66
- assert.equal(result[0].devices[0].geofences[0].days.length, 1)
67
- const first = result[0].devices[0].geofences[0].days[0]
68
- assert.equal(first.firstIn, '2023-02-27T21:53:16.000+0000')
69
- assert.equal(first.distanceIn, 93.03917199839687)
70
- assert.equal(first.distanceOut, 819.6685737216337)
71
- }, 4000000)
72
50
  })