fleetmap-reports 1.0.798 → 1.0.800

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.798",
3
+ "version": "1.0.800",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -166,6 +166,7 @@ function processDevices (from, to, devices, data, userData) {
166
166
  const toByDay = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59)
167
167
 
168
168
  const tripsByDay = trips.filter(t => (new Date(t.startTime) > fromByDay && new Date(t.endTime) < toByDay))
169
+ const routeByDay = trips.filter(p => (new Date(p.fixTime) > fromByDay && new Date(p.fixTime) < toByDay))
169
170
  const distance = tripsByDay.reduce((a, b) => a + b.distance, 0)
170
171
 
171
172
  if (!userData.allWeek && userData.weekDays && userData.dayHours) {
@@ -193,7 +194,7 @@ function processDevices (from, to, devices, data, userData) {
193
194
  summaryCurrentDay.distance = distance
194
195
  summaryCurrentDay.averageSpeed = distance > 0 ? ((trips.reduce((a, b) => a + (b.averageSpeed * b.distance), 0)) / distance) : 0
195
196
  summaryCurrentDay.maxSpeed = tripsByDay.reduce((a, b) => { return a > b.maxSpeed ? a : b.maxSpeed }, 0)
196
- summaryCurrentDay.convertedSpentFuel = calculateConsumption(d, { route: deviceRoute })
197
+ summaryCurrentDay.convertedSpentFuel = calculateConsumption(d, { route: routeByDay })
197
198
  summaryCurrentDay.startTime = tripsByDay.length && tripsByDay[0].startTime
198
199
  summaryCurrentDay.startAddress = tripsByDay.length && tripsByDay[0].startAddress
199
200
  summaryCurrentDay.endTime = tripsByDay.length && tripsByDay[tripsByDay.length - 1].endTime
@@ -447,7 +448,7 @@ function exportActivityReportToPDFVehicleGroupByDay (doc, translations, reportDa
447
448
  const data = []
448
449
  d.summary.forEach(s => {
449
450
  const temp = [
450
- new Date(s.date).toLocaleDateString() + ' - ' + weekDays[s.date.getDay()],
451
+ new Date(s.date).toLocaleDateString() + ' - ' + weekDays[new Date(s.date).getDay()],
451
452
  s.startTime ? new Date(s.startTime).toLocaleTimeString() : '',
452
453
  s.endTime ? new Date(s.endTime).toLocaleTimeString() : '',
453
454
  Number((s.distance / 1000).toFixed(1)),
@@ -512,7 +513,7 @@ function exportActivityReportToExcelVehicleGroupByDay (settings, translations, r
512
513
  name: d.device.name,
513
514
  group: group ? group.name : '',
514
515
  date: new Date(s.date).toLocaleDateString(),
515
- weekday: weekDays[s.date.getDay()],
516
+ weekday: weekDays[new Date(s.date).getDay()],
516
517
  start: s.startTime ? new Date(s.startTime).toLocaleTimeString() : '',
517
518
  end: s.endTime ? new Date(s.endTime).toLocaleTimeString() : '',
518
519
  distance: Number((s.distance / 1000).toFixed(0)),
@@ -583,7 +584,7 @@ function exportActivityReportToPDFDriverGroupByDay (doc, translations, reportDat
583
584
  const data = []
584
585
  d.summary.forEach(s => {
585
586
  const temp = [
586
- new Date(s.date).toLocaleDateString() + ' - ' + weekDays[s.date.getDay()],
587
+ new Date(s.date).toLocaleDateString() + ' - ' + weekDays[new Date(s.date).getDay()],
587
588
  s.startTime ? new Date(s.startTime).toLocaleTimeString() : '',
588
589
  s.endTime ? new Date(s.endTime).toLocaleTimeString() : '',
589
590
  Number((s.distance / 1000).toFixed(1)),
@@ -640,7 +641,7 @@ function exportActivityReportToExcelDriverGroupByDay (settings, translations, re
640
641
  name: d.driver.name,
641
642
  group: group ? group.name : '',
642
643
  date: new Date(s.date).toLocaleDateString(),
643
- weekday: weekDays[s.date.getDay()],
644
+ weekday: weekDays[new Date(s.date).getDay()],
644
645
  start: s.startTime ? new Date(s.startTime).toLocaleTimeString() : '',
645
646
  end: s.endTime ? new Date(s.endTime).toLocaleTimeString() : '',
646
647
  distance: Number((s.distance / 1000).toFixed(0)),