fleetmap-reports 1.0.805 → 1.0.806

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.
@@ -130,7 +130,8 @@ function processDevices (from, to, devices, data) {
130
130
  sensor: p.attributes.sensor,
131
131
  rain: p.attributes.rain,
132
132
  ignition: p.attributes.ignition,
133
- alarm: p.attributes.alarm
133
+ alarm: p.attributes.alarm,
134
+ input: p.attributes.input
134
135
  }
135
136
  }
136
137
  })
@@ -23,35 +23,6 @@ describe('Test_Reports', function () {
23
23
  console.log(utils.convertToLocaleString(new Date(), 'es-CL', 'Europe/Madrid'))
24
24
  })
25
25
 
26
- // eslint-disable-next-line no-undef
27
- it('Location by device', async () => {
28
- const report = await getReports()
29
- const userData = await report.getUserData()
30
-
31
- const data = await report.locationReport(
32
- new Date(Date.UTC(2022, 0, 4, 0, 0, 0, 0)),
33
- new Date(Date.UTC(2022, 0, 4, 23, 59, 59, 0)),
34
- userData)
35
-
36
- assert.equal(data.length, 1)
37
- const device = data[0].devices.find(d => d.device.id === 22326)
38
- assert.equal(device.positions.length, 708) // Total Positions
39
- }, 20000)
40
- // eslint-disable-next-line no-undef
41
- it('Location by driver', async () => {
42
- const report = await getReports()
43
- const userData = await report.getUserData()
44
- userData.byDriver = true
45
- const data = await report.locationReport(
46
- new Date(Date.UTC(2021, 11, 6, 0, 0, 0, 0)),
47
- new Date(Date.UTC(2021, 11, 9, 23, 59, 59, 0)),
48
- userData)
49
- assert.equal(data.length, 1)
50
- const driver = data[0].drivers.find(d => d.driver.id === 14020)
51
- console.log(driver.positions)
52
- assert.equal(driver.positions.length, 85) // Total Positions
53
- }, 20000)
54
- // eslint-disable-next-line no-undef
55
26
  it('Idle by device', async () => {
56
27
  const report = await getReports()
57
28
  const userData = await report.getUserData()
@@ -0,0 +1,38 @@
1
+ const { getReports } = require('./index')
2
+ const assert = require('assert')
3
+ // eslint-disable-next-line no-undef
4
+ describe('test positions', function () {
5
+ // eslint-disable-next-line no-undef
6
+ it('works by device', async () => {
7
+ const deviceId = 209673
8
+ const report = await getReports(process.env.USER_NOGARTEL, process.env.PASS_NOGARTEL)
9
+ const userData = await report.getUserData()
10
+ userData.devices = userData.devices.filter(d => d.id === deviceId)
11
+ const data = await report.locationReport(
12
+ new Date(Date.UTC(2023, 7, 24, 0, 0, 0, 0)),
13
+ new Date(Date.UTC(2023, 7, 24, 23, 59, 59, 0)),
14
+ userData)
15
+ assert.equal(data.length, 1)
16
+ console.log('data', data)
17
+ const device = data[0].devices.find(d => d.device.id === deviceId)
18
+ assert.equal(device.positions.length, 2414) // Total Positions
19
+ userData.includeDigitalPorts = true
20
+ const pdf = await report.locationReportToPDF(userData, data[0])
21
+ pdf.save('report.pdf')
22
+ }, 30000)
23
+ // eslint-disable-next-line no-undef
24
+ it('works by driver', async () => {
25
+ const report = await getReports()
26
+ const userData = await report.getUserData()
27
+ userData.byDriver = true
28
+ const data = await report.locationReport(
29
+ new Date(Date.UTC(2021, 11, 6, 0, 0, 0, 0)),
30
+ new Date(Date.UTC(2021, 11, 9, 23, 59, 59, 0)),
31
+ userData)
32
+ assert.equal(data.length, 1)
33
+ const driver = data[0].drivers.find(d => d.driver.id === 14020)
34
+ console.log(driver.positions)
35
+ assert.equal(driver.positions.length, 85) // Total Positions
36
+ }, 20000)
37
+ // eslint-disable-next-line no-undef
38
+ })