aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-10-06 14:23:35 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-10-06 14:23:35 -0700
commit87e9932ff6eec10dec78300cd9fb2532d1bfa538 (patch)
tree6a178241d476cb96386f1590b5acf9490b6b654f /src/main/java/org
parentaefc503d5fe01b7ec92bd4af7a57c45bc922aaa1 (diff)
downloadtrackermap-server-87e9932ff6eec10dec78300cd9fb2532d1bfa538.tar.gz
trackermap-server-87e9932ff6eec10dec78300cd9fb2532d1bfa538.tar.bz2
trackermap-server-87e9932ff6eec10dec78300cd9fb2532d1bfa538.zip
Remove legacy code
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/reports/ReportUtils.java15
-rw-r--r--src/main/java/org/traccar/reports/Summary.java11
-rw-r--r--src/main/java/org/traccar/reports/model/StopReport.java6
-rw-r--r--src/main/java/org/traccar/reports/model/SummaryReport.java6
4 files changed, 5 insertions, 33 deletions
diff --git a/src/main/java/org/traccar/reports/ReportUtils.java b/src/main/java/org/traccar/reports/ReportUtils.java
index c60c6ba1e..9a22b5f9b 100644
--- a/src/main/java/org/traccar/reports/ReportUtils.java
+++ b/src/main/java/org/traccar/reports/ReportUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org)
* Copyright 2016 - 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -263,21 +263,10 @@ public final class ReportUtils {
stop.setDuration(stopDuration);
stop.setSpentFuel(calculateFuel(startStop, endStop));
- long engineHours = 0;
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("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)) {
- engineHours += positions.get(i).getFixTime().getTime()
- - positions.get(i - 1).getFixTime().getTime();
- }
- }
+ stop.setEngineHours(endStop.getLong(Position.KEY_HOURS) - startStop.getLong(Position.KEY_HOURS));
}
- stop.setEngineHours(engineHours);
if (!ignoreOdometer
&& startStop.getDouble(Position.KEY_ODOMETER) != 0
diff --git a/src/main/java/org/traccar/reports/Summary.java b/src/main/java/org/traccar/reports/Summary.java
index 6d179a873..3883e7283 100644
--- a/src/main/java/org/traccar/reports/Summary.java
+++ b/src/main/java/org/traccar/reports/Summary.java
@@ -44,18 +44,10 @@ public final class Summary {
Position firstPosition = null;
Position previousPosition = null;
double speedSum = 0;
- boolean engineHoursEnabled = Context.getConfig().getBoolean("processing.engineHours.enable");
for (Position position : positions) {
if (firstPosition == null) {
firstPosition = position;
}
- 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());
- }
previousPosition = position;
speedSum += position.getSpeed();
result.setMaxSpeed(position.getSpeed());
@@ -66,8 +58,7 @@ public final class Summary {
result.setAverageSpeed(speedSum / positions.size());
result.setSpentFuel(ReportUtils.calculateFuel(firstPosition, previousPosition));
- if (engineHoursEnabled
- && firstPosition.getAttributes().containsKey(Position.KEY_HOURS)
+ if (firstPosition.getAttributes().containsKey(Position.KEY_HOURS)
&& previousPosition.getAttributes().containsKey(Position.KEY_HOURS)) {
result.setEngineHours(
previousPosition.getLong(Position.KEY_HOURS) - firstPosition.getLong(Position.KEY_HOURS));
diff --git a/src/main/java/org/traccar/reports/model/StopReport.java b/src/main/java/org/traccar/reports/model/StopReport.java
index 245292b63..fd8fa9335 100644
--- a/src/main/java/org/traccar/reports/model/StopReport.java
+++ b/src/main/java/org/traccar/reports/model/StopReport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2020 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -99,8 +99,4 @@ public class StopReport extends BaseReport {
public void setEngineHours(long engineHours) {
this.engineHours = engineHours;
}
-
- public void addEngineHours(long engineHours) {
- this.engineHours += engineHours;
- }
}
diff --git a/src/main/java/org/traccar/reports/model/SummaryReport.java b/src/main/java/org/traccar/reports/model/SummaryReport.java
index 6f9e9459f..886f8b9e2 100644
--- a/src/main/java/org/traccar/reports/model/SummaryReport.java
+++ b/src/main/java/org/traccar/reports/model/SummaryReport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org)
* Copyright 2016 - 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,8 +27,4 @@ public class SummaryReport extends BaseReport {
public void setEngineHours(long engineHours) {
this.engineHours = engineHours;
}
-
- public void addEngineHours(long engineHours) {
- this.engineHours += engineHours;
- }
}