fleetmap-reports 2.0.342 → 2.0.344
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 +1 -1
- package/src/trip-report.js +4 -2
- package/src/util/trips.js +3 -1
package/package.json
CHANGED
package/src/trip-report.js
CHANGED
|
@@ -535,7 +535,9 @@ function exportTripReportToExcel (userData, reportData) {
|
|
|
535
535
|
}
|
|
536
536
|
|
|
537
537
|
tripsData.forEach(d => {
|
|
538
|
-
const group = userData.
|
|
538
|
+
const group = userData.byDriver
|
|
539
|
+
? userData.groups.find(g => g.drivers && g.drivers.includes(d.id))
|
|
540
|
+
: userData.groups.find(g => g.id === d.device.groupId)
|
|
539
541
|
data = data.concat([{}])
|
|
540
542
|
data = data.concat(d.trips.map(a => {
|
|
541
543
|
return {
|
|
@@ -556,7 +558,7 @@ function exportTripReportToExcel (userData, reportData) {
|
|
|
556
558
|
maxTemp: a.maxTemp,
|
|
557
559
|
minTemp: a.minTemp,
|
|
558
560
|
avgTemp: a.avgTemp && Number(a.avgTemp.toFixed(1)),
|
|
559
|
-
model: d.device.model,
|
|
561
|
+
model: d.device && d.device.model,
|
|
560
562
|
group: group && group.name
|
|
561
563
|
}
|
|
562
564
|
}))
|
package/src/util/trips.js
CHANGED
|
@@ -219,7 +219,9 @@ function shouldRecalculate (trip, route) {
|
|
|
219
219
|
function getTripTotalKms (trip, stop, route) {
|
|
220
220
|
// we need to add stop kms to ensure that the total kms for the day, calculated with the odometer difference, will be equal to the sum of kms of all trips
|
|
221
221
|
const stopKms = stop &&
|
|
222
|
-
!route.find(p => p.attributes.putAccumulators
|
|
222
|
+
!route.find(p => p.attributes.putAccumulators
|
|
223
|
+
|| p.protocol === 'startek') //fix ticket 2263
|
|
224
|
+
&& (stop.endOdometer - stop.startOdometer)
|
|
223
225
|
let distance = trip.distance + (stop && stopKms > 0 ? stopKms : 0)
|
|
224
226
|
if (shouldRecalculate(trip, route)) {
|
|
225
227
|
distance = 0
|