fleetmap-reports 1.0.442 → 1.0.443

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.442",
3
+ "version": "1.0.443",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.test.js CHANGED
@@ -15,10 +15,12 @@ async function getSpeedingReport (report, userData) {
15
15
 
16
16
  // eslint-disable-next-line no-undef
17
17
  describe('Test_Reports', function () {
18
+ this.timeout(500000)
18
19
  // eslint-disable-next-line no-undef
19
20
  it('Speeding by device', async () => {
20
21
  const report = await getReports()
21
22
  const userData = await report.getUserData()
23
+ userData.roadSpeedLimit = true
22
24
  const { device, totalDistance, totalEventTime } = await getSpeedingReport(report, userData)
23
25
  assert.equal(device.alerts.length, 15) // Total Alerts
24
26
  assert.equal(totalDistance, 19.59984677533689) // Total Kms
@@ -50,7 +52,7 @@ describe('Test_Reports', function () {
50
52
  assert.equal(device.trips.length, 7) // Total Trips
51
53
  assert.equal(device.trips[0].endPOIName, 'Casa João')
52
54
  assert.equal(device.trips[1].endPOIName, undefined)
53
- assert.equal(device.totalDistance, 339170.3099999875) // Total Kms
55
+ assert.equal(device.totalDistance, 339204.53999999166) // Total Kms
54
56
  }, 20000)
55
57
  // eslint-disable-next-line no-undef
56
58
  it('Trip by driver', async () => {
@@ -63,7 +65,7 @@ describe('Test_Reports', function () {
63
65
  assert.equal(data.length, 1)
64
66
  console.log(data[0].drivers)
65
67
  const driver = data[0].drivers.find(d => d.driver.id === 14020)
66
- assert.equal(driver.trips.length, 13) // Total Trips
68
+ assert.equal(driver.trips.length, 9) // Total Trips
67
69
  assert.equal(driver.totalDuration, 6274000)
68
70
  assert.equal(driver.maxSpeed, 70.1944)
69
71
  }, 20000)
@@ -276,7 +276,7 @@ async function exportTripReportToPDF (userData, reportData) {
276
276
  tripsData.forEach(function (d, index) {
277
277
  const data = []
278
278
  const name = userData.byDriver ? d.driver.name : deviceName(d.device)
279
- const group = userData.byDriver ? userData.groups.find(g => g.drivers.includes(d.id)) : userData.groups.find(g => d.device.groupId === g.id)
279
+ const group = userData.byDriver ? userData.groups.find(g => g.drivers && g.drivers.includes(d.id)) : userData.groups.find(g => d.device.groupId === g.id)
280
280
 
281
281
  const space = index === 0 ? 8 : 0
282
282
  if (index) {
package/src/util/odoo.js CHANGED
@@ -1,14 +1,16 @@
1
1
 
2
- async function getOdooFuelServices(traccar, from, to) {
3
- const url = `/odoo/reports/refuelingServices?startDate=${from.toDateString()}&endDate=${to.toDateString()}`
2
+ async function getOdooFuelServices (traccar, from, to) {
3
+ const url = `/odoo/reports/refuelingServices?startDate=${from.toDateString()}&endDate=${to.toDateString()}`
4
4
 
5
- const {data} = await traccar.axios.get(url,{
6
- jar: traccar.cookieJar,
7
- withCredentials: true })
5
+ console.log('LOADING_MESSAGE:' + url)
6
+ const { data } = await traccar.axios.get(url, {
7
+ jar: traccar.cookieJar,
8
+ withCredentials: true
9
+ })
8
10
 
9
- console.log(data)
11
+ console.log(data)
10
12
 
11
- return data
13
+ return data
12
14
  }
13
15
 
14
16
  exports.getOdooFuelServices = getOdooFuelServices