fleetmap-reports 1.0.808 → 1.0.810

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.808",
3
+ "version": "1.0.810",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -51,16 +51,16 @@ async function createActivityReportByGroup (from, to, userData, traccarInstance)
51
51
  }
52
52
 
53
53
  const response = await traccarInstance.reports.reportsSummaryGet(from, to, null, [g.id])
54
- const summaries = response.data
54
+ const summary = response.data
55
55
 
56
56
  const responseTrips = await traccarInstance.reports.reportsTripsGet(from, to, null, [g.id])
57
57
  const trips = responseTrips.data
58
58
 
59
59
  devices.sort((a, b) => (a.name > b.name) ? 1 : -1)
60
60
 
61
- if (summaries.length > 0) {
62
- console.log('Summary:' + summaries.length)
63
- groupData.devices = processDevices(from, to, devices, { summaries, trips }, userData)
61
+ if (summary.length > 0) {
62
+ console.log('Summary:' + summary.length)
63
+ groupData.devices = processDevices(from, to, devices, { summary, trips }, userData)
64
64
 
65
65
  reportData.push(groupData)
66
66
  }
@@ -224,9 +224,7 @@ function processDevices (from, to, devices, data, userData) {
224
224
  endAddress: trips.length && trips[trips.length - 1].endAddress
225
225
  })
226
226
  } else {
227
- if (data.summaries) {
228
- summary.push(...data.summaries.filter(s => s.deviceId === d.id))
229
- }
227
+ summary.push(...data.summary.filter(s => s.deviceId === d.id))
230
228
 
231
229
  if (summary.length) {
232
230
  summary.forEach(s => {
@@ -226,7 +226,7 @@ function getEventType (a, translations, device) {
226
226
  if (a.attributes.alarm === 'sensor') { sensor = device.attributes.sensor1 }
227
227
  return sensor || translations.report['event_' + a.attributes.alarm] || a.attributes.alarm
228
228
  } else {
229
- return translations.report['event_' + a.type]
229
+ return translations.report['event_' + a.type] || a.type
230
230
  }
231
231
  }
232
232