fleetmap-reports 1.0.633 → 1.0.634

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.633",
3
+ "version": "1.0.634",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/kms-report.js CHANGED
@@ -164,8 +164,7 @@ function processDevices (from, to, devices, data, userData) {
164
164
 
165
165
  const trips = deviceTrips.filter(t => userData.allWeek || !userData.weekDays || isInsideTimetable(t, userData) || isPartialInsideTimetable(t, userData, deviceRoute))
166
166
 
167
- if (trips.length > 0) {
168
- if (userData.groupByDay) {
167
+ if (trips.length > 0 && userData.groupByDay) {
169
168
  trips.forEach(t => {
170
169
  t.tripDay = convertFromUTC(t.startTime, userData.user.attributes.timezone).toISOString().split('T')[0] + ' 12:00 PM'
171
170
  })
@@ -212,7 +211,7 @@ function processDevices (from, to, devices, data, userData) {
212
211
  })
213
212
  }
214
213
  }
215
- }
214
+
216
215
 
217
216
  return devicesResult
218
217
  }
@@ -398,7 +397,7 @@ function exportKmsReportToExcel (userData, reportData) {
398
397
  const info = userData.byDriver ? reportData.drivers : reportData.devices
399
398
  info.forEach(d => {
400
399
  const group = userData.byDriver
401
- ? userData.groups.find(g => g.drivers.includes(d.driver.id))
400
+ ? userData.groups.find(g => g.drivers && g.drivers.includes(d.driver.id))
402
401
  : userData.groups.find(g => d.device.groupId === g.id)
403
402
 
404
403
  if (userData.groupByDay) {