fleetmap-reports 1.0.555 → 1.0.556

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.555",
3
+ "version": "1.0.556",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -205,8 +205,17 @@ async function exportLocationReportToPDF (userData, reportData) {
205
205
 
206
206
  if (positionsData) {
207
207
  if (userData.includeDigitalPorts) {
208
- headers.push(getDigitalPort1Label(userData.byDriver ? positionsData[0].driver : positionsData[0].device, translations))
209
- headers.push(getDigitalPort2Label(userData.byDriver ? positionsData[0].driver : positionsData[0].device, translations))
208
+ headers.push(
209
+ getDigitalPort1Label(
210
+ userData.byDriver ? positionsData[0].driver : positionsData[0].device,
211
+ translations,
212
+ positionsData[0].device.attributes
213
+ ))
214
+ headers.push(
215
+ getDigitalPort2Label(
216
+ userData.byDriver ? positionsData[0].driver : positionsData[0].device,
217
+ translations,
218
+ positionsData[0].device.attributes))
210
219
  }
211
220
  headers.push('Latitude')
212
221
  headers.push('Longitude')
@@ -247,8 +256,8 @@ async function exportLocationReportToPDF (userData, reportData) {
247
256
  }
248
257
 
249
258
  if (userData.includeDigitalPorts) {
250
- temp.push(getDigitalPortValue(a, 1, translations))
251
- temp.push(getDigitalPortValue(a, 2, translations))
259
+ temp.push(getDigitalPortValue(a, 1, translations, d.attributes))
260
+ temp.push(getDigitalPortValue(a, 2, translations, d.attributes))
252
261
  }
253
262
  temp.push(a.latitude)
254
263
  temp.push(a.longitude)
@@ -296,18 +305,24 @@ function getTempValue (row) {
296
305
  )) || ''
297
306
  }
298
307
 
299
- function getDigitalPort1Label (row, translations) {
300
- return row.attributes.door1 || translations.report.digital_ports1
308
+ function getDigitalPort1Label (row, translations, dAttributes) {
309
+ return dAttributes.sensor1 || translations.report.digital_ports1
301
310
  }
302
311
 
303
312
  function getDigitalPort2Label (row, translations) {
304
313
  return row.attributes.door2 || translations.report.digital_ports2
305
314
  }
306
315
 
307
- function getDigitalPortValue (row, index, translations) {
316
+ function getDigitalPortValue (row, index, translations, dAttributes) {
308
317
  switch (index) {
309
318
  case 1:
310
- return row.attributes && row.attributes.door1 ? translations.report[row.attributes.door1] : ''
319
+ if (row.attributes && row.attributes.door1 !== undefined) {
320
+ return translations.report[row.attributes.door1]
321
+ }
322
+ if (row.attributes && row.attributes.sensor !== undefined) {
323
+ return dAttributes.sensor1On || row.attributes.sensor
324
+ }
325
+ break
311
326
  case 2:
312
327
  if (row.attributes && row.attributes.door2) {
313
328
  return translations.report[row.attributes.door2]
@@ -80,27 +80,18 @@ async function createZoneReport (from, to, userData, traccar) {
80
80
  return reportData
81
81
  }
82
82
 
83
- async function getAllInOne (
83
+ async function getRoute (
84
84
  traccar,
85
85
  from,
86
86
  to,
87
87
  devices,
88
- getRoutes,
89
- getTrips,
90
- getStops,
91
- getSummary,
92
88
  currentDeviceCount = 0,
93
89
  totalDevices = devices.length,
94
90
  sliceSize = 5,
95
91
  devicesPerRequest = 1,
96
92
  counter = undefined,
97
93
  userData) {
98
- let url = `/reports/allinone?from=${from.toISOString()}&to=${to.toISOString()}`
99
- if (getRoutes) url += '&type=route'
100
- if (getTrips) url += '&type=trips'
101
- if (getStops) url += '&type=stops'
102
- if (getSummary) url += '&type=summary'
103
-
94
+ const url = `/reports/allinone?from=${from.toISOString()}&to=${to.toISOString()}&type=route`
104
95
  const sliced = automaticReports.sliceArray(devices, sliceSize)
105
96
  const result = []
106
97
  console.log('getAll, slicing', sliceSize)