fleetmap-reports 1.0.771 → 1.0.773
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
|
@@ -15,36 +15,15 @@ async function createPerformanceReport (from, to, userData, traccar) {
|
|
|
15
15
|
const allInOne = await traccarHelper.getAllInOne(traccar, from, to, slice, true, true, false, false, deviceCount, devices.length)
|
|
16
16
|
|
|
17
17
|
slice.forEach(d => {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
drivingConsumption, idleConsumption, cruiseControlConsumption, economicConsumption, drivingDistance, cruiseControlDistance,
|
|
21
|
-
economicDistance
|
|
22
|
-
} = getDeviceData(allInOne, d)
|
|
23
|
-
|
|
24
|
-
const deviceData = {
|
|
25
|
-
device: d.name,
|
|
26
|
-
drivingTime,
|
|
27
|
-
idleTime,
|
|
28
|
-
drivingConsumption,
|
|
29
|
-
idleConsumption,
|
|
30
|
-
drivingDistance,
|
|
31
|
-
cruiseControlTime,
|
|
32
|
-
cruiseControlConsumption,
|
|
33
|
-
cruiseControlDistance,
|
|
34
|
-
economicTime,
|
|
35
|
-
economicConsumption,
|
|
36
|
-
economicDistance,
|
|
37
|
-
highEngineRPM,
|
|
38
|
-
hardBreaking,
|
|
39
|
-
hardAcceleration
|
|
40
|
-
}
|
|
18
|
+
const deviceData = getDeviceData(allInOne, d)
|
|
19
|
+
deviceData.device = d.name
|
|
41
20
|
reportData.push(deviceData)
|
|
42
21
|
})
|
|
43
22
|
|
|
44
23
|
deviceCount = deviceCount + slice.length
|
|
45
24
|
}
|
|
46
25
|
} else {
|
|
47
|
-
const allInOne = await traccarHelper.getAllInOne(traccar, from, to, userData.devices, true, true, false,
|
|
26
|
+
const allInOne = await traccarHelper.getAllInOne(traccar, from, to, userData.devices, true, true, false, true)
|
|
48
27
|
|
|
49
28
|
const device = userData.devices[0]
|
|
50
29
|
|
|
@@ -145,22 +124,30 @@ function getDeviceData (allInOne, d) {
|
|
|
145
124
|
economicDistance
|
|
146
125
|
}
|
|
147
126
|
} else {
|
|
127
|
+
const deviceSummary = allInOne.summary.filter(t => t.deviceId === d.id)
|
|
128
|
+
|
|
148
129
|
const drivingTime = deviceTrips.reduce((a, b) => a + b.duration, 0)
|
|
149
|
-
const
|
|
130
|
+
const drivingConsumption = deviceTrips.reduce((a, b) => a + b.spentFuel, 0)
|
|
131
|
+
const drivingDistance = deviceSummary.distance
|
|
132
|
+
const idleTime = deviceSummary.engineHours - drivingTime
|
|
133
|
+
const idleConsumption = deviceSummary.spentFuel - drivingConsumption
|
|
134
|
+
|
|
135
|
+
const hardBreaking = deviceRoute.filter(p => p.attributes.io253 === 2).length
|
|
136
|
+
const hardAcceleration = deviceRoute.filter(p => p.attributes.io253 === 1).length
|
|
150
137
|
|
|
151
138
|
return {
|
|
152
|
-
drivingTime
|
|
153
|
-
idleTime
|
|
139
|
+
drivingTime,
|
|
140
|
+
idleTime,
|
|
154
141
|
cruiseControlTime: 0,
|
|
155
142
|
economicTime: 0,
|
|
156
143
|
highEngineRPM: 0,
|
|
157
|
-
hardBreaking
|
|
158
|
-
hardAcceleration
|
|
159
|
-
drivingConsumption
|
|
160
|
-
idleConsumption
|
|
144
|
+
hardBreaking,
|
|
145
|
+
hardAcceleration,
|
|
146
|
+
drivingConsumption,
|
|
147
|
+
idleConsumption,
|
|
161
148
|
cruiseControlConsumption: 0,
|
|
162
149
|
economicConsumption: 0,
|
|
163
|
-
drivingDistance
|
|
150
|
+
drivingDistance,
|
|
164
151
|
cruiseControlDistance: 0,
|
|
165
152
|
economicDistance: 0
|
|
166
153
|
}
|
|
@@ -7,14 +7,14 @@ describe('performance', function () {
|
|
|
7
7
|
it('performance report', async () => {
|
|
8
8
|
const report = await getReports()
|
|
9
9
|
const userData = await report.getUserData()
|
|
10
|
-
userData.devices = userData.devices.filter(d => d.
|
|
10
|
+
userData.devices = userData.devices.filter(d => d.id === 22326)
|
|
11
11
|
const data = await createPerformanceReport(
|
|
12
12
|
new Date(Date.UTC(2023, 5, 10, 0, 0, 0, 0)),
|
|
13
13
|
new Date(Date.UTC(2023, 5, 20, 23, 59, 59, 0)),
|
|
14
14
|
userData,
|
|
15
15
|
report.traccar)
|
|
16
16
|
console.log(data)
|
|
17
|
-
})
|
|
17
|
+
}, 5000000)
|
|
18
18
|
|
|
19
19
|
// eslint-disable-next-line no-undef
|
|
20
20
|
it('performance report 2', async () => {
|