aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup/default.xml3
-rw-r--r--src/org/traccar/BasePipelineFactory.java2
-rw-r--r--src/org/traccar/reports/ReportUtils.java3
-rw-r--r--src/org/traccar/reports/Summary.java7
4 files changed, 8 insertions, 7 deletions
diff --git a/setup/default.xml b/setup/default.xml
index 8f3fb988f..5d79f563f 100644
--- a/setup/default.xml
+++ b/setup/default.xml
@@ -21,11 +21,10 @@
<entry key='filter.enable'>true</entry>
<entry key='filter.future'>3600</entry>
- <entry key='engineHours.enable'>true</entry>
-
<entry key='event.enable'>true</entry>
<entry key='event.ignoreDuplicateAlerts'>true</entry>
<entry key='processing.computedAttributes.enable'>true</entry>
+ <entry key='processing.engineHours.enable'>true</entry>
<entry key='media.path'>./media</entry>
diff --git a/src/org/traccar/BasePipelineFactory.java b/src/org/traccar/BasePipelineFactory.java
index e325a6033..b0de67a15 100644
--- a/src/org/traccar/BasePipelineFactory.java
+++ b/src/org/traccar/BasePipelineFactory.java
@@ -156,7 +156,7 @@ public abstract class BasePipelineFactory implements ChannelPipelineFactory {
motionHandler = new MotionHandler(Context.getTripsConfig().getSpeedThreshold());
- if (Context.getConfig().getBoolean("engineHours.enable")) {
+ if (Context.getConfig().getBoolean("processing.engineHours.enable")) {
engineHoursHandler = new EngineHoursHandler();
}
diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java
index 94cc7664f..ea383d598 100644
--- a/src/org/traccar/reports/ReportUtils.java
+++ b/src/org/traccar/reports/ReportUtils.java
@@ -266,7 +266,8 @@ public final class ReportUtils {
if (startStop.getAttributes().containsKey(Position.KEY_HOURS)
&& endStop.getAttributes().containsKey(Position.KEY_HOURS)) {
engineHours = endStop.getLong(Position.KEY_HOURS) - startStop.getLong(Position.KEY_HOURS);
- } else if (Context.getConfig().getBoolean("engineHours.enable")) {
+ } else if (Context.getConfig().getBoolean("processing.engineHours.enable")) {
+ // Temporary fallback for old data, to be removed in May 2019
for (int i = startIndex + 1; i <= endIndex; i++) {
if (positions.get(i).getBoolean(Position.KEY_IGNITION)
&& positions.get(i - 1).getBoolean(Position.KEY_IGNITION)) {
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(