fleetmap-reports 1.0.685 → 1.0.686

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.685",
3
+ "version": "1.0.686",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -143,7 +143,7 @@ function exportFuelConsumptionReportToExcel (userData, reportData) {
143
143
  { label: translations.report.date, value: 'date' },
144
144
  { label: translations.report.distance, value: 'kms' },
145
145
  { label: translations.report.consumption, value: 'consumption' },
146
- { label: translations.report.avg_consumption, value: 'avg_consumption' },
146
+ { label: (lang === 'pt-BR' ? translations.report.avg_consumption_by_liters : translations.report.avg_consumption), value: 'avg_consumption' },
147
147
  { label: translations.report.duration, value: 'duration' },
148
148
  { label: translations.report.odometer, value: 'accumulated_kms' },
149
149
  { label: translations.report.refueling, value: 'refueling' }
@@ -159,7 +159,7 @@ function exportFuelConsumptionReportToExcel (userData, reportData) {
159
159
  consumption: r.spentFuel > 0 ? formatNumber(r.spentFuel, lang) : 0,
160
160
  avg_consumption: formatNumber(lang === 'pt-BR' ? r.avgConsumption.byLiters : r.avgConsumption.byKms, lang),
161
161
  duration: convertMS(r.duration),
162
- accumulated_kms: (r.endOdometer / 100).toFixed(1),
162
+ accumulated_kms: formatNumber((r.endOdometer / 100), lang),
163
163
  refueling: formatNumber(r.refueling, lang)
164
164
  }
165
165
  }))
@@ -196,7 +196,7 @@ async function exportFuelConsumptionReportToPDF (userData, reportData) {
196
196
  translations.report.date,
197
197
  translations.report.distance,
198
198
  translations.report.consumption,
199
- translations.report.avg_consumption,
199
+ (lang === 'pt-BR' ? translations.report.avg_consumption_by_liters : translations.report.avg_consumption),
200
200
  translations.report.duration,
201
201
  translations.report.odometer,
202
202
  translations.report.refueling
@@ -226,8 +226,8 @@ async function exportFuelConsumptionReportToPDF (userData, reportData) {
226
226
  r.spentFuel > 0 ? formatNumber(r.spentFuel, lang) : 0,
227
227
  formatNumber(lang === 'pt-BR' ? r.avgConsumption.byLiters : r.avgConsumption.byKms, lang),
228
228
  convertMS(r.duration),
229
- (r.endOdometer / 1000).toFixed(1),
230
- r.refueling
229
+ formatNumber((r.endOdometer / 1000), lang),
230
+ formatNumber(r.refueling, lang)
231
231
  ]))
232
232
 
233
233
  const footValues = [
@@ -285,7 +285,7 @@ function getTotalRefueling (user, data) {
285
285
  }
286
286
 
287
287
  function getTotalAvgConsumption (user, data) {
288
- const values = data.map(a => a.distance * a.avgConsumption.byKms).reduce((a, b) => a + b, 0)
288
+ const values = data.map(a => a.distance * (user.attributes.lang === 'pt-BR' ? a.avgConsumption.byLiters : a.avgConsumption.byKms)).reduce((a, b) => a + b, 0)
289
289
  const totalKms = data.reduce((a, b) => a + b.distance, 0)
290
290
 
291
291
  const totalAvgConsumption = values / totalKms