fleetmap-reports 1.0.219 → 1.0.220

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.219",
3
+ "version": "1.0.220",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/kms-report.js CHANGED
@@ -69,7 +69,7 @@ function processDevices(from, to, devices, data) {
69
69
  const dayLocations = groupedLocations.get(key)
70
70
  const day = {
71
71
  date: key,
72
- kms: dayLocations.reduce((a, b) => a + (b.attributes.distance || 0), 0)
72
+ kms: dayLocations.reduce((a, b) => a + b.attributes.distance, 0)
73
73
  }
74
74
  days.push(day)
75
75
  })
@@ -157,7 +157,7 @@ async function exportKmsReportToPDF(userData, reportData) {
157
157
  d.days.forEach(day => {
158
158
  const temp = [
159
159
  new Date(day.date).toLocaleDateString(),
160
- ((day.kms || 0)/1000).toFixed(0)
160
+ day.kms ? (day.kms/1000).toFixed(0) : 0
161
161
  ]
162
162
 
163
163
  data.push(temp)
@@ -166,7 +166,7 @@ async function exportKmsReportToPDF(userData, reportData) {
166
166
  const footValues = []
167
167
  footValues.push(
168
168
  '',
169
- (d.days.reduce((a, b) => a + (b.kms || 0), 0)/1000).toFixed(0)
169
+ (d.days.reduce((a, b) => a + b.kms, 0)/1000).toFixed(0)
170
170
  )
171
171
 
172
172
  const style = getStyle(getUserPartner(userData.user))
@@ -263,7 +263,7 @@ function exportKmsReportToExcel(userData, reportData) {
263
263
  name: userData.byDriver ? d.driver.name : d.device.name,
264
264
  group: group ? group.name : '',
265
265
  date: a.date,
266
- distance: Number(((a.kms || 0) / 1000).toFixed(0))
266
+ distance: Number((a.kms / 1000).toFixed(0))
267
267
  }
268
268
  }))
269
269
  } else {