fleetmap-reports 2.0.318 → 2.0.320

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.318",
3
+ "version": "2.0.320",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -14,7 +14,7 @@ function processDevices (from, to, devices, data, userData) {
14
14
  const result = []
15
15
 
16
16
  for (const d of devices) {
17
- const positions = data.route.filter(t => t.deviceId === d.id).filter(t => t.attributes.motion)
17
+ const positions = data.route.filter(t => t.deviceId === d.id)
18
18
 
19
19
  const statusPeriodBySensor = computeSensorPeriods(positions, userData.sensors, d, userData)
20
20
 
@@ -566,12 +566,14 @@ function exportSpeedingReportToExcel (userData, reportData) {
566
566
  const translations = getTranslations(userData)
567
567
  const overspeedData = userData.byDriver ? reportData.drivers : reportData.devices
568
568
 
569
- const settings = {
569
+
570
+ const settings = {
570
571
  sheetName: translations.report.titleSpeedingReport.substring(0, 31), // The name of the sheet
571
572
  fileName // The name of the spreadsheet
572
573
  }
573
574
  const headers = [
574
575
  userData.byDriver ? { label: translations.report.driver, value: 'driver' } : { label: translations.report.vehicle, value: 'name' },
576
+ userData.byDriver ? { label: translations.report.group, value: 'groupName' } : { label: translations.report.group, value: 'groupName' },
575
577
  { label: translations.report.date, value: 'fixTime' },
576
578
  { label: translations.report.address, value: 'address' },
577
579
  {
@@ -595,7 +597,9 @@ function exportSpeedingReportToExcel (userData, reportData) {
595
597
  overspeedData.forEach(d => {
596
598
  data = data.concat([{}])
597
599
  data = data.concat(d.alerts.map(a => {
600
+ const group = userData.groups.find(g => g.id === a.groupId)
598
601
  return {
602
+ groupName: group ? group.name : '',
599
603
  driver: userData.byDriver ? d.driver.name : a.driver,
600
604
  speed: Math.round(a.attributes.speed * 1.85200),
601
605
  distance: a.distance && new Intl.NumberFormat(lang, { maximumSignificantDigits: 1 }).format(a.distance),