fleetmap-reports 1.0.588 → 1.0.589

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.588",
3
+ "version": "1.0.589",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -167,6 +167,7 @@ async function exportFuelConsumptionReportToPDF (userData, reportData) {
167
167
  const translations = getTranslations(userData)
168
168
  const lang = getLanguage(userData)
169
169
 
170
+ // eslint-disable-next-line new-cap
170
171
  const doc = new jsPDF.jsPDF('l')
171
172
  await headerFromUser(doc, translations.report.titleFuelConsumptionReport, userData.user)
172
173
 
@@ -262,7 +262,7 @@ async function exportTripReportToPDF (userData, reportData) {
262
262
  ]
263
263
 
264
264
  if (tripsData) {
265
- const withFuelData = tripsData.reduce((a, b) => a || b.totalFuelConsumption !== undefined)
265
+ const withFuelData = tripsData.find(t => t.totalFuelConsumption !== undefined)
266
266
 
267
267
  if (withFuelData) {
268
268
  headers.push(translations.report.consumption,
@@ -320,7 +320,7 @@ async function exportTripReportToPDF (userData, reportData) {
320
320
 
321
321
  temp.push(convertMS(a.stopEngineHours),
322
322
  convertMS(a.stopDuration),
323
- Intl.NumberFormat(userData.user.attributes.lang, { maximumFractionDigits: 2 }).format(a.totalKms),
323
+ Intl.NumberFormat(userData.user.attributes.lang, { maximumFractionDigits: 1 }).format(a.totalKms),
324
324
  Math.round(a.averageSpeed * 1.85200),
325
325
  Math.round(a.maxSpeed * 1.85200))
326
326
 
@@ -399,7 +399,7 @@ function exportTripReportToExcel (userData, reportData) {
399
399
 
400
400
  let data = []
401
401
  if (tripsData) {
402
- const withFuelData = tripsData.reduce((a, b) => a || b.totalFuelConsumption !== undefined)
402
+ const withFuelData = tripsData.find(b => b.totalFuelConsumption !== undefined)
403
403
 
404
404
  if (withFuelData) {
405
405
  headers.push({ label: translations.report.consumption, value: 'consumption' },
@@ -486,7 +486,7 @@ function getSumTotalKms (user, data) {
486
486
  const values = data.map(item => {
487
487
  return item.totalKms ? parseFloat(item.totalKms) : 0
488
488
  })
489
- return Intl.NumberFormat(user.attributes.lang, { maximumFractionDigits: 2 }).format(values.reduce((a, b) => a + b, 0))
489
+ return Intl.NumberFormat(user.attributes.lang, { maximumFractionDigits: 1 }).format(values.reduce((a, b) => a + b, 0))
490
490
  }
491
491
 
492
492
  function getSumAvgSpeed (data) {