fleetmap-reports 1.0.311 → 1.0.315
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/activity-report.js +7 -7
- package/src/events-report.js +2 -2
- package/src/idle-report.js +1 -1
- package/src/speeding-report.js +6 -6
package/package.json
CHANGED
package/src/activity-report.js
CHANGED
|
@@ -301,8 +301,8 @@ function exportActivityReportToPDF_Driver(doc, translations, reportData, userDat
|
|
|
301
301
|
|
|
302
302
|
const footValues = ['Total:' + reportData.drivers.length,
|
|
303
303
|
(reportData.drivers.reduce((a, b) => a + b.summary[0].distance, 0) / 1000).toFixed(0),
|
|
304
|
-
getSumAvgSpeed(reportData.drivers),
|
|
305
|
-
getSumMaxSpeed(reportData.drivers),
|
|
304
|
+
getSumAvgSpeed(reportData.drivers, userData),
|
|
305
|
+
getSumMaxSpeed(reportData.drivers, userData),
|
|
306
306
|
convertMS(reportData.drivers.reduce((a, b) => a + b.summary[0].engineHours, 0))]
|
|
307
307
|
|
|
308
308
|
const style = getStyle(getUserPartner(userData.user))
|
|
@@ -345,10 +345,10 @@ function exportActivityReportToPDF_Vehicle(doc, translations, reportData, userDa
|
|
|
345
345
|
'',
|
|
346
346
|
(reportData.devices.reduce((a, b) => a + b.summary[0].distance, 0) / 1000).toFixed(0),
|
|
347
347
|
'', '',
|
|
348
|
-
getSumAvgSpeed(reportData.devices),
|
|
349
|
-
getSumMaxSpeed(reportData.devices),
|
|
348
|
+
getSumAvgSpeed(reportData.devices, userData),
|
|
349
|
+
getSumMaxSpeed(reportData.devices, userData),
|
|
350
350
|
convertMS(reportData.devices.reduce((a, b) => a + b.summary[0].engineHours, 0)),
|
|
351
|
-
getSumSpentFuel(reportData.devices)]
|
|
351
|
+
getSumSpentFuel(reportData.devices, userData)]
|
|
352
352
|
|
|
353
353
|
const style = getStyle(getUserPartner(userData.user))
|
|
354
354
|
addTable(doc, headers, data, footValues, style, 35)
|
|
@@ -543,8 +543,8 @@ function exportActivityReportToPDF_Driver_GroupByDay(doc, translations, reportDa
|
|
|
543
543
|
|
|
544
544
|
const footValues = ['Total:' + d.summary.length,
|
|
545
545
|
(d.summary.reduce((a, b) => a + b.distance, 0) / 1000).toFixed(0),
|
|
546
|
-
getSumAvgSpeed(d.summary),
|
|
547
|
-
getSumMaxSpeed(d.summary),
|
|
546
|
+
getSumAvgSpeed(d.summary, userData),
|
|
547
|
+
getSumMaxSpeed(d.summary, userData),
|
|
548
548
|
convertMS(d.summary.reduce((a, b) => a + b.engineHours, 0))]
|
|
549
549
|
|
|
550
550
|
const style = getStyle(getUserPartner(userData.user))
|
package/src/events-report.js
CHANGED
|
@@ -46,7 +46,7 @@ async function createEventsReport(from, to, userData, traccar) {
|
|
|
46
46
|
|
|
47
47
|
if(data.length > 0) {
|
|
48
48
|
reportData.push({
|
|
49
|
-
devices: await processDevices(from, to, withoutGroupDevices, userData.geofences, userData.drivers, data),
|
|
49
|
+
devices: await processDevices(from, to, withoutGroupDevices, userData.geofences, userData.drivers, data, traccar),
|
|
50
50
|
xpert: withoutGroupDevices.filter(d => d.attributes.xpert).length > 0
|
|
51
51
|
})
|
|
52
52
|
}
|
|
@@ -71,7 +71,7 @@ async function getReportData(from, to, devices, types, traccar) {
|
|
|
71
71
|
return data
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
async function processDevices(from, to, devices, geofences, drivers, data) {
|
|
74
|
+
async function processDevices(from, to, devices, geofences, drivers, data, traccar) {
|
|
75
75
|
const devicesResult = []
|
|
76
76
|
|
|
77
77
|
for (const d of devices) {
|
package/src/idle-report.js
CHANGED
|
@@ -18,7 +18,7 @@ async function createIdleReport(from, to, userData, traccarInstance) {
|
|
|
18
18
|
reportData.push(...allData)
|
|
19
19
|
} else {
|
|
20
20
|
console.log("ByDevice")
|
|
21
|
-
const report = await createTripReportByDevice(from, to, userData, traccarInstance)
|
|
21
|
+
const report = await createTripReportByDevice(from, to, userData.devices, userData, traccarInstance)
|
|
22
22
|
reportData.push(report)
|
|
23
23
|
}
|
|
24
24
|
|
package/src/speeding-report.js
CHANGED
|
@@ -54,7 +54,7 @@ async function createSpeedingReportByGroup(from, to, userData, traccarInstance){
|
|
|
54
54
|
devices.sort((a, b) => (a.name > b.name) ? 1 : -1)
|
|
55
55
|
|
|
56
56
|
if (events.length > 0) {
|
|
57
|
-
groupData.devices = await processDevices(from, to, devices, events, routes)
|
|
57
|
+
groupData.devices = await processDevices(from, to, devices, events, routes, userData)
|
|
58
58
|
reportData.push(groupData)
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -75,7 +75,7 @@ async function createSpeedingReportByDevice(from, to, devices, userData, traccar
|
|
|
75
75
|
const routes = await traccarHelper.getRoute(traccarInstance, from, to, devices)
|
|
76
76
|
const events = []
|
|
77
77
|
if(!userData.useVehicleSpeedLimit && userData.customSpeed){
|
|
78
|
-
events.push(...await getCustomSpeedLimitEvents(devices, routes))
|
|
78
|
+
events.push(...await getCustomSpeedLimitEvents(devices, routes, userData.customSpeed))
|
|
79
79
|
} else {
|
|
80
80
|
events.push(...await traccarHelper.getEvents(traccarInstance, from, to, devices, eventTypes))
|
|
81
81
|
}
|
|
@@ -90,7 +90,7 @@ async function createSpeedingReportByDevice(from, to, devices, userData, traccar
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
return {
|
|
93
|
-
devices: await processDevices(from, to, devices, events, routes),
|
|
93
|
+
devices: await processDevices(from, to, devices, events, routes, userData),
|
|
94
94
|
xpert: devices.filter(d => d && d.attributes && d.attributes.xpert).length > 0
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -107,7 +107,7 @@ async function createSpeedingReportByDriver(from, to, userData) {
|
|
|
107
107
|
const routes = await traccarHelper.getRoute(traccarInstance, from, to, devices)
|
|
108
108
|
const events = []
|
|
109
109
|
if(!userData.useVehicleSpeedLimit && userData.customSpeed){
|
|
110
|
-
events.push(...await getCustomSpeedLimitEvents(devices, routes))
|
|
110
|
+
events.push(...await getCustomSpeedLimitEvents(devices, routes, userData.customSpeed))
|
|
111
111
|
} else {
|
|
112
112
|
events.push(...await traccarHelper.getEvents(traccarInstance, from, to, devices, eventTypes))
|
|
113
113
|
}
|
|
@@ -198,10 +198,10 @@ async function findEventsPosition(from, to, devices, events, routes, userData){
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
async function getCustomSpeedLimitEvents(devices, routes,
|
|
201
|
+
async function getCustomSpeedLimitEvents(devices, routes, customSpeed){
|
|
202
202
|
console.log('custom speed limit events')
|
|
203
203
|
const events = []
|
|
204
|
-
const maxSpeed =
|
|
204
|
+
const maxSpeed = customSpeed / 1.85200
|
|
205
205
|
|
|
206
206
|
for (const d of devices) {
|
|
207
207
|
const positions = routes.filter(p => p.deviceId === d.id)
|