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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "2.0.75",
3
+ "version": "2.0.77",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -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('fleetmap.joao.penas5@gmail.com', 'penas46881')
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, 15, 0, 0, 0, 0),
28
- new Date(2024, 2, 15, 23, 59, 59, 0),
29
- userData)
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 === 134090)
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
- const odometerKms = trips.length > 0 ? trips[trips.length - 1].endOdometer - trips[0].startOdometer : 0
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) {