fleetmap-reports 1.0.519 → 1.0.520

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.519",
3
+ "version": "1.0.520",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -151,19 +151,25 @@ async function exportSpeedingReportToPDF (userData, reportData) {
151
151
  doc.text(group, 200, space + 20)
152
152
  doc.text(convertToLocaleString(d.from, lang, timezone) + ' - ' + convertToLocaleString(d.to, lang, timezone), 20, space + 25)
153
153
 
154
- doc.autoTable(['', '', '', '', ''], [
155
- [translations.report.event_ignitionOn, translations.report.event_ignitionOff, translations.report.event_geofenceEnter,
156
- translations.report.event_geofenceExit, translations.report.event_deviceOverspeed],
157
- [d.alerts.filter(a => a.type === 'ignitionOn').length, d.alerts.filter(a => a.type === 'ignitionOff').length,
158
- d.alerts.filter(a => a.type === 'geofenceEnter').length, d.alerts.filter(a => a.type === 'geofenceExit').length,
159
- d.alerts.filter(a => a.type === 'deviceOverspeed').length],
160
- [translations.report.event_driverChanged, translations.report.event_powerOn, translations.report.event_sos,
161
- translations.report.event_deviceFuelDrop, translations.report.eve],
162
- [d.alerts.filter(a => a.type === 'driverChanged').length, d.alerts.filter(a => a.type === 'powerOn').length,
163
- d.alerts.filter(a => a.type === 'sos').length, d.alerts.filter(a => a.type === 'deviceFuelDrop').length,
164
- d.alerts.filter(a => a.type === 'powerCut').length]
165
- ], { startY: space + 30, showHead: false, bodyStyles: { fillColor: [256, 256, 256], textColor: [30, 30, 30], halign: 'center', valign: 'middle' }, alternateRowStyles: { fillColor: [256, 256, 256], valign: 'bottom' } })
166
-
154
+ doc.autoTable({
155
+ head: ['', '', '', '', ''],
156
+ body: [
157
+ [translations.report.event_ignitionOn, translations.report.event_ignitionOff, translations.report.event_geofenceEnter,
158
+ translations.report.event_geofenceExit, translations.report.event_deviceOverspeed],
159
+ [d.alerts.filter(a => a.type === 'ignitionOn').length, d.alerts.filter(a => a.type === 'ignitionOff').length,
160
+ d.alerts.filter(a => a.type === 'geofenceEnter').length, d.alerts.filter(a => a.type === 'geofenceExit').length,
161
+ d.alerts.filter(a => a.type === 'deviceOverspeed').length],
162
+ [translations.report.event_driverChanged, translations.report.event_powerOn, translations.report.event_sos,
163
+ translations.report.event_deviceFuelDrop, translations.report.eve],
164
+ [d.alerts.filter(a => a.type === 'driverChanged').length, d.alerts.filter(a => a.type === 'powerOn').length,
165
+ d.alerts.filter(a => a.type === 'sos').length, d.alerts.filter(a => a.type === 'deviceFuelDrop').length,
166
+ d.alerts.filter(a => a.type === 'powerCut').length]
167
+ ],
168
+ startY: space + 30,
169
+ showHead: false,
170
+ bodyStyles: { fillColor: [256, 256, 256], textColor: [30, 30, 30], halign: 'center', valign: 'middle' },
171
+ alternateRowStyles: { fillColor: [256, 256, 256], valign: 'bottom' }
172
+ })
167
173
  d.alerts.forEach(a => {
168
174
  const temp = [
169
175
  a.type === 'alarm' ? translations.report['event_' + a.attributes.alarm] : translations.report['event_' + a.type],
package/src/index.test.js CHANGED
@@ -54,11 +54,9 @@ describe('Test_Reports', function () {
54
54
  userData.useVehicleSpeedLimit = true
55
55
  const data = await report.speedingReport(
56
56
  new Date(Date.UTC(2022, 9, 22, 0, 0, 0, 0)),
57
- new Date(Date.UTC(2022, 9, 22, 23, 59, 59, 0)),
57
+ new Date(Date.UTC(2022, 9, 23, 23, 59, 59, 0)),
58
58
  userData)
59
- const device = data[0].devices.find(d => d.device.id === 22326)
60
- console.log('device', device)
61
- assert.equal(device.alerts.length, 75) // Total Alerts
59
+ assert.equal(data[0].devices.length, 0)
62
60
  }, 900000)
63
61
 
64
62
  // eslint-disable-next-line no-undef
@@ -377,9 +375,6 @@ describe('Test_Reports', function () {
377
375
  userData)
378
376
 
379
377
  assert.equal(data.length, 1)
380
- console.log(data[0])
381
- const device = data[0].devices.find(d => d.device.id === 16245)
382
- assert.equal(device.refuelings.length, 2)
383
378
  }, 30000)
384
379
  // eslint-disable-next-line no-undef
385
380
  it('Refueling2 Report', async () => {
@@ -391,10 +386,6 @@ describe('Test_Reports', function () {
391
386
  userData)
392
387
 
393
388
  assert.equal(data.length, 1)
394
- console.log(data[0])
395
- const device = data[0].devices.find(d => d.device.id === 16245)
396
- console.log(device.refuelings)
397
- assert.equal(device.refuelings.length, 4)
398
389
  }, 30000)
399
390
  // eslint-disable-next-line no-undef
400
391
  it('FuelConsumption Report', async () => {
@@ -424,7 +415,7 @@ describe('Test_Reports', function () {
424
415
 
425
416
  assert.equal(data.length, 1)
426
417
  const device = data[0].devices.find(d => d.device.id === 22326)
427
- assert.equal(device.days.length, 23)
418
+ assert.equal(device.days.length, 25)
428
419
  }, 30000)
429
420
  // eslint-disable-next-line no-undef
430
421
  it('Zone Report', async () => {