fleetmap-reports 2.0.72 → 2.0.73

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/util/fuel.js +8 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "2.0.72",
3
+ "version": "2.0.73",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/util/fuel.js CHANGED
@@ -27,18 +27,14 @@ function getRefuelingLiters (d, position, diff) {
27
27
 
28
28
  function calculateConsumption (d, data, avgConsumption) {
29
29
  let fuelConsumption = 0
30
- if (useOdooFuelData(d, data.route) && avgConsumption) {
31
- fuelConsumption = (avgConsumption.byKms * (data.trips.reduce((a, b) => a + b.distance, 0) / 1000) / 100)
32
- } else {
33
- const withFuelUsed = data.route && data.route.find(p => p.attributes.fuelUsed)
34
- if (data.summary) {
35
- fuelConsumption = calculateSpentFuel(data.summary.spentFuel, d, withFuelUsed)
36
- } else if (data.trips && data.stops) {
37
- const spentFuel = data.trips.reduce((a, b) => a + b.spentFuel, 0) + data.stops.reduce((a, b) => a + b.spentFuel, 0)
38
- fuelConsumption = calculateSpentFuel(spentFuel, d, withFuelUsed)
39
- } else if (data.route && data.route.length > 1 && data.route[0].attributes.fuelUsed) {
40
- fuelConsumption = data.route[data.route.length - 1].attributes.fuelUsed - data.route[0].attributes.fuelUsed
41
- }
30
+ const withFuelUsed = data.route && data.route.find(p => p.attributes.fuelUsed)
31
+ if (data.summary) {
32
+ fuelConsumption = calculateSpentFuel(data.summary.spentFuel, d, withFuelUsed)
33
+ } else if (data.trips && data.stops) {
34
+ const spentFuel = data.trips.reduce((a, b) => a + b.spentFuel, 0) + data.stops.reduce((a, b) => a + b.spentFuel, 0)
35
+ fuelConsumption = calculateSpentFuel(spentFuel, d, withFuelUsed)
36
+ } else if (data.route && data.route.length > 1 && data.route[0].attributes.fuelUsed) {
37
+ fuelConsumption = data.route[data.route.length - 1].attributes.fuelUsed - data.route[0].attributes.fuelUsed
42
38
  }
43
39
  return fuelConsumption > 0 ? fuelConsumption : 0
44
40
  }