diff options
Diffstat (limited to 'src/org/traccar/reports/ReportUtils.java')
-rw-r--r-- | src/org/traccar/reports/ReportUtils.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java index 9541e1027..1402e10d4 100644 --- a/src/org/traccar/reports/ReportUtils.java +++ b/src/org/traccar/reports/ReportUtils.java @@ -61,10 +61,8 @@ public final class ReportUtils { public static double calculateDistance(Position firstPosition, Position lastPosition, boolean useOdometer) { double distance = 0.0; - double firstOdometer = 0.0; - double lastOdometer = 0.0; - firstOdometer = firstPosition.getDouble(Position.KEY_ODOMETER); - lastOdometer = lastPosition.getDouble(Position.KEY_ODOMETER); + double firstOdometer = firstPosition.getDouble(Position.KEY_ODOMETER); + double lastOdometer = lastPosition.getDouble(Position.KEY_ODOMETER); if (useOdometer && (firstOdometer != 0.0 || lastOdometer != 0.0)) { distance = lastOdometer - firstOdometer; @@ -85,10 +83,10 @@ public final class ReportUtils { 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())); + 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; |