fleetmap-reports 2.0.75 → 2.0.77
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/tests/fuel.test.js +6 -5
- package/src/util/fuel.js +0 -6
- package/src/util/trips.js +1 -2
package/package.json
CHANGED
package/src/tests/fuel.test.js
CHANGED
|
@@ -21,14 +21,15 @@ describe('Test_Reports', function () {
|
|
|
21
21
|
|
|
22
22
|
it('Fuel Consumption 1', async () => {
|
|
23
23
|
console.log('trip by device')
|
|
24
|
-
const report = await getReports('
|
|
24
|
+
const report = await getReports('aghani@moviflotte.com', 'X8Tm<QT*')
|
|
25
25
|
const userData = await report.getUserData()
|
|
26
|
+
userData.devices = userData.devices.filter(d => d.id === 133608)
|
|
26
27
|
|
|
27
|
-
const data = await report.fuelConsumptionReport(new Date(2024, 2,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const data = await report.fuelConsumptionReport(new Date(2024, 2, 18, 0, 0, 0, 0),
|
|
29
|
+
new Date(2024, 2, 18, 23, 59, 59, 0),
|
|
30
|
+
userData)
|
|
30
31
|
|
|
31
|
-
const device = data[0].devices.find(d => d.device.id ===
|
|
32
|
+
const device = data[0].devices.find(d => d.device.id === 133608)
|
|
32
33
|
assert.equal(device.days[0].spentFuel, 9)
|
|
33
34
|
}, 30000)
|
|
34
35
|
})
|
package/src/util/fuel.js
CHANGED
|
@@ -46,12 +46,6 @@ function calculateSpentFuel (value, device, withFuelUsed) {
|
|
|
46
46
|
return withFuelUsed ? value : (value * device.attributes.fuel_tank_capacity) / 100
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
if (device.attributes.fuel_low_threshold && device.attributes.fuel_high_threshold) {
|
|
50
|
-
const valueSignalCheck = value * fuelSignalInverter(device)
|
|
51
|
-
const valuePercentage = (valueSignalCheck * 100) / Math.abs(device.attributes.fuel_low_threshold - device.attributes.fuel_high_threshold)
|
|
52
|
-
return Math.round((valuePercentage * device.attributes.fuel_tank_capacity) / 100)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
49
|
return value
|
|
56
50
|
}
|
|
57
51
|
|
package/src/util/trips.js
CHANGED
|
@@ -139,8 +139,7 @@ async function getDataByDay (device, date, data, userData, traccarInstance) {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
function getKms (trips) {
|
|
142
|
-
|
|
143
|
-
return odometerKms > 0 ? odometerKms : trips.filter(t => t.distance > 0).reduce((a, b) => a + b.distance, 0)
|
|
142
|
+
return trips.filter(t => t.distance > 0).reduce((a, b) => a + b.distance, 0)
|
|
144
143
|
}
|
|
145
144
|
|
|
146
145
|
function isInsideTimetable (t, userData) {
|