fleetmap-reports 1.0.569 → 1.0.570

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.569",
3
+ "version": "1.0.570",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -174,7 +174,7 @@ async function exportSpeedingReportToPDF (userData, reportData) {
174
174
  d.alerts.forEach(a => {
175
175
  const temp = [
176
176
  a.type === 'alarm'
177
- ? translations.report['event_' + a.attributes.alarm] || a.attributes.alarm
177
+ ? getEventType(a, translations, d.device)
178
178
  : translations.report['event_' + a.type],
179
179
  getAlertDate(userData.user, a),
180
180
  a.geofenceName || (a.position ? a.position.address : ''),
@@ -216,6 +216,12 @@ async function exportSpeedingReportToPDF (userData, reportData) {
216
216
  }
217
217
  }
218
218
 
219
+ function getEventType (a, translations, device) {
220
+ let sensor
221
+ if (a.attributes.alarm === 'sensor') { sensor = device.attributes.sensor1 }
222
+ return sensor || translations.report['event_' + a.attributes.alarm] || a.attributes.alarm
223
+ }
224
+
219
225
  function exportSpeedingReportToExcel (userData, reportData) {
220
226
  console.log('exportSpeedingReportToExcel')
221
227
 
@@ -242,7 +248,7 @@ function exportSpeedingReportToExcel (userData, reportData) {
242
248
  return {
243
249
  name: d.device.name,
244
250
  eventType: a.type === 'alarm'
245
- ? translations.report['event_' + a.attributes.alarm] || a.attributes.alarm
251
+ ? getEventType(a, translations, d.device)
246
252
  : translations.report['event_' + a.type],
247
253
  fixTime: getAlertDate(userData.user, a),
248
254
  address: a.geofenceName || (a.position ? a.position.address : ''),