fleetmap-reports 1.0.457 → 1.0.461
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/location-report.js +10 -2
- package/src/trip-report.js +4 -2
package/package.json
CHANGED
package/src/location-report.js
CHANGED
|
@@ -188,6 +188,8 @@ async function exportLocationReportToPDF (userData, reportData) {
|
|
|
188
188
|
headers.push(getDigitalPort1Label(userData.byDriver ? positionsData[0].driver : positionsData[0].device, translations))
|
|
189
189
|
headers.push(getDigitalPort2Label(userData.byDriver ? positionsData[0].driver : positionsData[0].device, translations))
|
|
190
190
|
}
|
|
191
|
+
headers.push('Latitude')
|
|
192
|
+
headers.push('Longitude')
|
|
191
193
|
|
|
192
194
|
let first = true
|
|
193
195
|
// eslint-disable-next-line new-cap
|
|
@@ -228,7 +230,8 @@ async function exportLocationReportToPDF (userData, reportData) {
|
|
|
228
230
|
temp.push(getDigitalPortValue(a, 1, translations))
|
|
229
231
|
temp.push(getDigitalPortValue(a, 2, translations))
|
|
230
232
|
}
|
|
231
|
-
|
|
233
|
+
temp.push(a.latitude)
|
|
234
|
+
temp.push(a.longitude)
|
|
232
235
|
data.push(temp)
|
|
233
236
|
})
|
|
234
237
|
|
|
@@ -330,6 +333,9 @@ function exportLocationReportToExcel (userData, reportData) {
|
|
|
330
333
|
headers.push({ label: translations.report.temperature, value: 'temperature' })
|
|
331
334
|
}
|
|
332
335
|
|
|
336
|
+
headers.push({ label: 'latitude', value: 'latitude' })
|
|
337
|
+
headers.push({ label: 'longitude', value: 'longitude' })
|
|
338
|
+
|
|
333
339
|
let data = []
|
|
334
340
|
if (positionsData) {
|
|
335
341
|
if (userData.includeDigitalPorts) {
|
|
@@ -349,7 +355,9 @@ function exportLocationReportToExcel (userData, reportData) {
|
|
|
349
355
|
driver: userData.byDriver ? d.driver.name : getDriverName(a, userData.drivers),
|
|
350
356
|
temperature: getTempValue(a),
|
|
351
357
|
digitalport1: getDigitalPortValue(a, 1, translations),
|
|
352
|
-
digitalport2: getDigitalPortValue(a, 2, translations)
|
|
358
|
+
digitalport2: getDigitalPortValue(a, 2, translations),
|
|
359
|
+
latitude: a.latitude,
|
|
360
|
+
longitude: a.longitude
|
|
353
361
|
}
|
|
354
362
|
}))
|
|
355
363
|
})
|
package/src/trip-report.js
CHANGED
|
@@ -134,6 +134,10 @@ async function createTripReportByDriver (from, to, userData, traccar) {
|
|
|
134
134
|
d.totalDuration = d.trips.reduce((a, b) => a + b.duration, 0)
|
|
135
135
|
d.totalDistance = d.trips.reduce((a, b) => a + b.distance, 0)
|
|
136
136
|
d.maxSpeed = d.trips.reduce((a, b) => { return a > b.maxSpeed ? a : b.maxSpeed }, 0)
|
|
137
|
+
d.trips = d.trips.sort((a, b) => new Date(a.startTime).getTime() - new Date(b.startTime).getTime())
|
|
138
|
+
d.trips.forEach(function (trip, i) {
|
|
139
|
+
trip.stopDuration = i !== d.trips.length - 1 ? (new Date(d.trips[i + 1].startTime) - new Date(trip.endTime)) : 0
|
|
140
|
+
})
|
|
137
141
|
})
|
|
138
142
|
|
|
139
143
|
return report
|
|
@@ -214,8 +218,6 @@ function processDrivers (from, to, userData, data) {
|
|
|
214
218
|
const trips = data.trips.filter(t => t.driverUniqueId === d.uniqueId &&
|
|
215
219
|
(userData.allWeek || !userData.weekDays || isInsideTimetable(t, userData) || isPartialInsideTimetable(t, userData, route)))
|
|
216
220
|
|
|
217
|
-
trips.sort((a, b) => new Date(a.startTime).getTime() - new Date(b.startTime).getTime())
|
|
218
|
-
|
|
219
221
|
const idleEvents = getIdleEvents(data.route, d)
|
|
220
222
|
|
|
221
223
|
trips.forEach(function (trip, i) {
|