From 786f101fab6a81007f67e868d381302f4a502d77 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Thu, 31 May 2018 10:18:29 +0500 Subject: - Rename switch and variable - Add temporary comment --- src/org/traccar/reports/Summary.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/org/traccar/reports/Summary.java') diff --git a/src/org/traccar/reports/Summary.java b/src/org/traccar/reports/Summary.java index f57372e8d..9810424d8 100644 --- a/src/org/traccar/reports/Summary.java +++ b/src/org/traccar/reports/Summary.java @@ -44,14 +44,15 @@ public final class Summary { Position firstPosition = null; Position previousPosition = null; double speedSum = 0; - boolean needCalculateEngineHours = Context.getConfig().getBoolean("engineHours.enable"); + boolean engineHoursEnabled = Context.getConfig().getBoolean("processing.engineHours.enable"); for (Position position : positions) { if (firstPosition == null) { firstPosition = position; } - if (needCalculateEngineHours && previousPosition != null + if (engineHoursEnabled && previousPosition != null && position.getBoolean(Position.KEY_IGNITION) && previousPosition.getBoolean(Position.KEY_IGNITION)) { + // Temporary fallback for old data, to be removed in May 2019 result.addEngineHours(position.getFixTime().getTime() - previousPosition.getFixTime().getTime()); } @@ -65,7 +66,7 @@ public final class Summary { result.setAverageSpeed(speedSum / positions.size()); result.setSpentFuel(ReportUtils.calculateFuel(firstPosition, previousPosition)); - if (needCalculateEngineHours + if (engineHoursEnabled && firstPosition.getAttributes().containsKey(Position.KEY_HOURS) && previousPosition.getAttributes().containsKey(Position.KEY_HOURS)) { result.setEngineHours( -- cgit v1.2.3