fleetmap-reports 1.0.802 → 1.0.804

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.802",
3
+ "version": "1.0.804",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -51,16 +51,16 @@ async function createActivityReportByGroup (from, to, userData, traccarInstance)
51
51
  }
52
52
 
53
53
  const response = await traccarInstance.reports.reportsSummaryGet(from, to, null, [g.id])
54
- const summaries = response.data
54
+ const summary = response.data
55
55
 
56
56
  const responseTrips = await traccarInstance.reports.reportsTripsGet(from, to, null, [g.id])
57
57
  const trips = responseTrips.data
58
58
 
59
59
  devices.sort((a, b) => (a.name > b.name) ? 1 : -1)
60
60
 
61
- if (summaries.length > 0) {
62
- console.log('Summary:' + summaries.length)
63
- groupData.devices = processDevices(from, to, devices, { summaries, trips }, userData)
61
+ if (summary.length > 0) {
62
+ console.log('Summary:' + summary.length)
63
+ groupData.devices = processDevices(from, to, devices, { summary, trips }, userData)
64
64
 
65
65
  reportData.push(groupData)
66
66
  }
@@ -224,7 +224,7 @@ function processDevices (from, to, devices, data, userData) {
224
224
  endAddress: trips.length && trips[trips.length - 1].endAddress
225
225
  })
226
226
  } else {
227
- summary.push(...data.summaries.filter(s => s.deviceId === d.id))
227
+ summary.push(...data.summary.filter(s => s.deviceId === d.id))
228
228
 
229
229
  if (summary.length) {
230
230
  summary.forEach(s => {
@@ -401,7 +401,7 @@ function exportActivityReportToPDFVehicle (doc, translations, reportData, userDa
401
401
  Math.round(d.summary[0].averageSpeed * 1.85200),
402
402
  Math.round(d.summary[0].maxSpeed * 1.85200),
403
403
  convertMS(d.summary[0].engineHours),
404
- d.summary[0].convertedSpentFuel >= 0 ? d.summary[0].convertedSpentFuel : 0
404
+ Math.round(d.summary[0].convertedSpentFuel >= 0 ? d.summary[0].convertedSpentFuel : 0)
405
405
  ]
406
406
  data.push(temp)
407
407
  }
@@ -457,7 +457,7 @@ function exportActivityReportToPDFVehicleGroupByDay (doc, translations, reportDa
457
457
  Math.round(s.averageSpeed * 1.85200),
458
458
  Math.round(s.maxSpeed * 1.85200),
459
459
  convertMS(s.engineHours),
460
- s.convertedSpentFuel >= 0 ? s.convertedSpentFuel : 0
460
+ Math.round(s.convertedSpentFuel >= 0 ? s.convertedSpentFuel : 0)
461
461
  ]
462
462
 
463
463
  data.push(temp)
@@ -522,7 +522,7 @@ function exportActivityReportToExcelVehicleGroupByDay (settings, translations, r
522
522
  avgSpeed: Math.round(s.averageSpeed * 1.85200),
523
523
  maxSpeed: Math.round(s.maxSpeed * 1.85200),
524
524
  engineHours: convertMS(s.engineHours),
525
- spentFuel: s.convertedSpentFuel >= 0 ? s.convertedSpentFuel : 0
525
+ spentFuel: Math.round(s.convertedSpentFuel >= 0 ? s.convertedSpentFuel : 0)
526
526
  }
527
527
  }))
528
528
  })
@@ -721,7 +721,7 @@ function exportActivityReportToExcelVehicle (settings, translations, reportData,
721
721
  avgSpeed: Math.round(d.summary[0].averageSpeed * 1.85200),
722
722
  maxSpeed: Math.round(d.summary[0].maxSpeed * 1.85200),
723
723
  engineHours: convertMS(d.summary[0].engineHours),
724
- spentFuel: d.summary[0].convertedSpentFuel >= 0 ? d.summary[0].convertedSpentFuel : 0
724
+ spentFuel: Math.round(d.summary[0].convertedSpentFuel >= 0 ? d.summary[0].convertedSpentFuel : 0)
725
725
  }])
726
726
  }
727
727
  })