fleetmap-reports 2.0.124 → 2.0.126
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
|
@@ -22,7 +22,7 @@ async function createDelayedStartReport (from, to, userData, traccar) {
|
|
|
22
22
|
const sliced = automaticReports.sliceArray(devices, 5)
|
|
23
23
|
let deviceCount = 0
|
|
24
24
|
for (const slice of sliced) {
|
|
25
|
-
const allInOne = await traccarHelper.getAllInOne(traccar, from, to, slice,
|
|
25
|
+
const allInOne = await traccarHelper.getAllInOne(traccar, from, to, slice, true, true, false, false, deviceCount, devices.length)
|
|
26
26
|
|
|
27
27
|
for (const d of slice) {
|
|
28
28
|
const deviceData = await processDeviceData(from, to, allInOne, d, userData, traccar)
|
|
@@ -60,6 +60,8 @@ function getDelayDescription (startTime, activityStart, lowDelay, mediumDelay, h
|
|
|
60
60
|
|
|
61
61
|
async function processDeviceData (from, to, allInOne, d, userData, traccar) {
|
|
62
62
|
const trips = allInOne.trips.filter(t => t.deviceId === d.id)
|
|
63
|
+
const route = allInOne.route.filter(t => t.deviceId === d.id)
|
|
64
|
+
|
|
63
65
|
const translations = getTranslations(userData)
|
|
64
66
|
|
|
65
67
|
const weekDays = [
|
|
@@ -76,12 +78,26 @@ async function processDeviceData (from, to, allInOne, d, userData, traccar) {
|
|
|
76
78
|
|
|
77
79
|
const days = []
|
|
78
80
|
for (const date of dates) {
|
|
79
|
-
const { tripsByDay } = await getDataByDay(d, date, { trips }, userData, traccar)
|
|
81
|
+
const { tripsByDay, routeByDay } = await getDataByDay(d, date, { trips, route }, userData, traccar)
|
|
82
|
+
|
|
83
|
+
let startTime
|
|
84
|
+
let endTime
|
|
85
|
+
if (userData.useIgnition) {
|
|
86
|
+
const firstIgnitionOn = routeByDay.find(p => p.attributes.ignition)
|
|
87
|
+
if (firstIgnitionOn) {
|
|
88
|
+
startTime = firstIgnitionOn.fixTime
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
if (tripsByDay.length) {
|
|
92
|
+
startTime = tripsByDay[0].startTime
|
|
93
|
+
}
|
|
94
|
+
}
|
|
80
95
|
|
|
81
|
-
if (tripsByDay.length
|
|
82
|
-
|
|
83
|
-
|
|
96
|
+
if (tripsByDay.length) {
|
|
97
|
+
endTime = tripsByDay[tripsByDay.length - 1].endTime
|
|
98
|
+
}
|
|
84
99
|
|
|
100
|
+
if (startTime) {
|
|
85
101
|
const deviceDayData = {
|
|
86
102
|
device: d.name,
|
|
87
103
|
groupId: d.groupId,
|
package/src/zone-report.js
CHANGED
|
@@ -65,13 +65,14 @@ async function createZoneReport (from, to, userData, traccar) {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
const reportRangeDays = (new Date(to).getTime() - new Date(from).getTime()) / 1000 * 60 * 60 * 24
|
|
68
69
|
const sliced = automaticReports.sliceArray(devices, sliceSize)
|
|
69
70
|
|
|
70
71
|
let deviceCount = 0
|
|
71
72
|
for (const slice of sliced) {
|
|
72
73
|
const data = await traccarHelper.getAllInOne(
|
|
73
74
|
traccar, from, to, slice, true, false, false, false,
|
|
74
|
-
deviceCount, devices.length, sliceSize, deviceChunk, undefined)
|
|
75
|
+
deviceCount, devices.length, sliceSize, reportRangeDays > 31 ? 1 : deviceChunk, undefined)
|
|
75
76
|
|
|
76
77
|
const route = filterPositions(data.route)
|
|
77
78
|
const alerts = []
|