fleetmap-reports 2.0.154 → 2.0.156

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": "2.0.154",
3
+ "version": "2.0.156",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -240,6 +240,11 @@ async function exportSpeedingReportToPDF (userData, reportData) {
240
240
  }
241
241
 
242
242
  function getEventType (a, translations, device, userData) {
243
+ const result = _getEventType(a, translations, device, userData)
244
+ return a.attributes.info ? `${result} (${a.attributes.info})` : result
245
+ }
246
+
247
+ function _getEventType (a, translations, device, userData) {
243
248
  if (a.type === 'alarm') {
244
249
  let sensor
245
250
  if (a.attributes.alarm === 'sensor') { sensor = device.attributes.sensor1 }
@@ -248,14 +253,10 @@ function getEventType (a, translations, device, userData) {
248
253
  const result = translations.report['event_' + a.type] || a.type
249
254
  try {
250
255
  if (userData &&
251
- userData.notifications &&
252
- userData.notifications.length &&
253
- a.type === 'maintenance' &&
254
- a.attributes.notifications) {
255
- const notification = userData.notifications.find(n => a.attributes.notifications.split(',').includes(n.id.toString()))
256
- if (notification) {
257
- return `${result} ${notification.attributes.name}`
258
- }
256
+ userData.maintenances &&
257
+ a.type === 'maintenance') {
258
+ const maintenance = userData.maintenances.find(m => m.id === a.maintenanceId)
259
+ if (maintenance) { return `${result} ${maintenance.name}` }
259
260
  }
260
261
  } catch (e) {
261
262
  console.error(e)