fleetmap-reports 2.0.154 → 2.0.155

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.155",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -248,14 +248,10 @@ function getEventType (a, translations, device, userData) {
248
248
  const result = translations.report['event_' + a.type] || a.type
249
249
  try {
250
250
  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
- }
251
+ userData.maintenances &&
252
+ a.type === 'maintenance') {
253
+ const maintenance = userData.maintenances.find(m => m.id === a.maintenanceId)
254
+ if (maintenance) { return `${result} ${maintenance.name}` }
259
255
  }
260
256
  } catch (e) {
261
257
  console.error(e)