fleetmap-reports 1.0.665 → 1.0.667
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/zone-report.js +12 -12
package/package.json
CHANGED
package/src/zone-report.js
CHANGED
|
@@ -136,6 +136,13 @@ async function processDevices (from, to, devices, userData, data) {
|
|
|
136
136
|
const routeDayBefore = deviceRoute.filter(p => (!zoneInOutDayData[0].inTime || new Date(p.fixTime) > new Date(zoneInOutDayData[0].inTime.fixTime)) &&
|
|
137
137
|
new Date(p.fixTime) < fromByDay)
|
|
138
138
|
distanceIn = distanceIn - calculateDistance(routeDayBefore)
|
|
139
|
+
} else {
|
|
140
|
+
// Add distanceOut before the first entry
|
|
141
|
+
const routeOut = deviceRoute.filter(p =>
|
|
142
|
+
new Date(p.fixTime).getTime() < new Date(zoneInOutDayData[0].inTime.fixTime).getTime() &&
|
|
143
|
+
new Date(p.fixTime).getTime() >= fromByDay.getTime()
|
|
144
|
+
)
|
|
145
|
+
distanceOut = distanceOut + calculateDistance(routeOut)
|
|
139
146
|
}
|
|
140
147
|
|
|
141
148
|
// Check if the last entry ends only on the next day
|
|
@@ -145,7 +152,9 @@ async function processDevices (from, to, devices, userData, data) {
|
|
|
145
152
|
const routeDayAfter = deviceRoute.filter(p => new Date(p.fixTime) < outTime && new Date(p.fixTime) > toByDay)
|
|
146
153
|
distanceIn = distanceIn - calculateDistance(routeDayAfter)
|
|
147
154
|
} else {
|
|
148
|
-
const routeOut = deviceRoute.filter(p =>
|
|
155
|
+
const routeOut = deviceRoute.filter(p =>
|
|
156
|
+
new Date(p.fixTime) > new Date(zoneInOutDayData[zoneInOutDayData.length - 1].outTime.fixTime).getTime() &&
|
|
157
|
+
new Date(p.fixTime) < toByDay.getTime())
|
|
149
158
|
distanceOut = distanceOut + calculateDistance(routeOut)
|
|
150
159
|
}
|
|
151
160
|
}
|
|
@@ -263,17 +272,6 @@ function analyseAlertsGroupGeofences (alerts, deviceRoute, from, to) {
|
|
|
263
272
|
})
|
|
264
273
|
}
|
|
265
274
|
|
|
266
|
-
if (zoneInOutData.length > 0) {
|
|
267
|
-
if (zoneInOutData[0].inTime) {
|
|
268
|
-
// Add distanceOut before the first entry
|
|
269
|
-
const routeOut = deviceRoute.filter(p =>
|
|
270
|
-
new Date(p.fixTime).getTime() < new Date(zoneInOutData[0].inTime.fixTime).getTime() &&
|
|
271
|
-
new Date(p.fixTime).getTime() <= to.getTime()
|
|
272
|
-
)
|
|
273
|
-
zoneInOutData[0].distanceOut = calculateDistance(routeOut)
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
275
|
return zoneInOutData
|
|
278
276
|
}
|
|
279
277
|
|
|
@@ -522,6 +520,7 @@ function exportZoneReportToExcel (userData, reportData) {
|
|
|
522
520
|
}
|
|
523
521
|
const headers = userData.groupByDay
|
|
524
522
|
? [
|
|
523
|
+
{ label: translations.report.vehicle, value: 'name' },
|
|
525
524
|
{ label: translations.report.date, value: 'date' },
|
|
526
525
|
{ label: translations.report.firstIn, value: 'firstIn' },
|
|
527
526
|
{ label: translations.report.lastOut, value: 'lastOut' },
|
|
@@ -547,6 +546,7 @@ function exportZoneReportToExcel (userData, reportData) {
|
|
|
547
546
|
data = userData.groupByDay
|
|
548
547
|
? data.concat(d.days.map(a => {
|
|
549
548
|
return {
|
|
549
|
+
name: d.device.name,
|
|
550
550
|
date: convertToLocaleDateString(a.date, userData.user.attributes.lang, userData.user.attributes.timezone),
|
|
551
551
|
firstIn: a.firstIn ? convertToLocaleTimeString(a.firstIn, userData.user.attributes.lang, userData.user.attributes.timezone) : '-',
|
|
552
552
|
lastOut: a.lastOut ? convertToLocaleTimeString(a.lastOut, userData.user.attributes.lang, userData.user.attributes.timezone) : '-',
|