fleetmap-reports 1.0.658 → 1.0.659
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/stop-report.js +11 -10
package/package.json
CHANGED
package/src/stop-report.js
CHANGED
|
@@ -33,15 +33,11 @@ async function createStopReportByDevice (from, to, userData, traccar) {
|
|
|
33
33
|
|
|
34
34
|
let deviceCount = 0
|
|
35
35
|
for (const slice of sliced) {
|
|
36
|
-
const allInOne = await traccarHelper.getAllInOne(traccar, from, to, slice,
|
|
37
|
-
|
|
36
|
+
const allInOne = await traccarHelper.getAllInOne(traccar, from, to, slice, true, false, true, false, deviceCount, devices.length)
|
|
37
|
+
console.log('Stops:' + allInOne.stops.length)
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (stopsData.length > 0) {
|
|
42
|
-
allData.devices.push(...processDevices(from, to, slice, {
|
|
43
|
-
stops: stopsData
|
|
44
|
-
}, userData))
|
|
39
|
+
if (allInOne.stops.length > 0) {
|
|
40
|
+
allData.devices.push(...processDevices(from, to, slice, allInOne, userData))
|
|
45
41
|
}
|
|
46
42
|
deviceCount = deviceCount + slice.length
|
|
47
43
|
}
|
|
@@ -54,6 +50,7 @@ function processDevices (from, to, devices, data, userData) {
|
|
|
54
50
|
|
|
55
51
|
devices.forEach(d => {
|
|
56
52
|
const deviceStops = data.stops.filter(t => t.deviceId === d.id)
|
|
53
|
+
const route = data.route.filter(t => t.deviceId === d.id)
|
|
57
54
|
|
|
58
55
|
deviceStops.forEach(stop => {
|
|
59
56
|
const nearestPOIs = getNearestPOIs(stop.longitude, stop.latitude, userData.geofences)
|
|
@@ -75,6 +72,10 @@ function processDevices (from, to, devices, data, userData) {
|
|
|
75
72
|
})
|
|
76
73
|
|
|
77
74
|
if (deviceStops.length > 0) {
|
|
75
|
+
if (route.length && !route[0].attributes.ignition) {
|
|
76
|
+
deviceStops[0].startTime = undefined
|
|
77
|
+
}
|
|
78
|
+
|
|
78
79
|
const deviceData = {
|
|
79
80
|
device: d,
|
|
80
81
|
from,
|
|
@@ -211,11 +212,11 @@ function exportStopReportToExcel (userData, reportData) {
|
|
|
211
212
|
}
|
|
212
213
|
|
|
213
214
|
function getStopStart (user, stop) {
|
|
214
|
-
return convertToLocaleString(stop.startTime, user.attributes.lang, user.attributes.timezone)
|
|
215
|
+
return stop.startTime ? convertToLocaleString(stop.startTime, user.attributes.lang, user.attributes.timezone) : ''
|
|
215
216
|
}
|
|
216
217
|
|
|
217
218
|
function getStopEnd (user, stop) {
|
|
218
|
-
return convertToLocaleString(stop.endTime, user.attributes.lang, user.attributes.timezone)
|
|
219
|
+
return stop.endTime ? convertToLocaleString(stop.endTime, user.attributes.lang, user.attributes.timezone) : ''
|
|
219
220
|
}
|
|
220
221
|
|
|
221
222
|
exports.createStopReport = createStopReport
|