diff options
Diffstat (limited to 'src/org/traccar/reports/ReportUtils.java')
-rw-r--r-- | src/org/traccar/reports/ReportUtils.java | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java index 02e3764bc..acc8e4e3b 100644 --- a/src/org/traccar/reports/ReportUtils.java +++ b/src/org/traccar/reports/ReportUtils.java @@ -90,24 +90,12 @@ public final class ReportUtils { if (firstPosition.getAttributes().get(Position.KEY_FUEL_LEVEL) != null && lastPosition.getAttributes().get(Position.KEY_FUEL_LEVEL) != null) { - try { - switch (firstPosition.getProtocol()) { - case "meitrack": - case "galileo": - case "noran": - BigDecimal v = new BigDecimal( - firstPosition.getAttributes().get(Position.KEY_FUEL_LEVEL).toString()); - v = v.subtract(new BigDecimal( - lastPosition.getAttributes().get(Position.KEY_FUEL_LEVEL).toString())); - return v.setScale(2, RoundingMode.HALF_EVEN).toString() + " %"; - default: - break; - } - } catch (Exception error) { - Log.warning(error); - } + + BigDecimal value = new BigDecimal(firstPosition.getDouble(Position.KEY_FUEL_LEVEL) + - lastPosition.getDouble(Position.KEY_FUEL_LEVEL)); + return value.setScale(1, RoundingMode.HALF_EVEN).toString(); } - return "-"; + return null; } public static org.jxls.common.Context initializeContext(long userId) { |