aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/reports/Summary.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-08-13 20:36:46 +0500
committerAbyss777 <abyss@fox5.ru>2016-08-13 20:36:46 +0500
commit82c2d713d4da71f8eeef3e134b06dbb0abf37633 (patch)
treecd9ae5e6e49073ae756220a5159e7e2b9207428a /src/org/traccar/reports/Summary.java
parentb47795087d138ccd6d9634aadcfd29cbca629218 (diff)
downloadtrackermap-server-82c2d713d4da71f8eeef3e134b06dbb0abf37633.tar.gz
trackermap-server-82c2d713d4da71f8eeef3e134b06dbb0abf37633.tar.bz2
trackermap-server-82c2d713d4da71f8eeef3e134b06dbb0abf37633.zip
- Split distance to distance and total distance
- Switch summary report to total distance - Move DistanceHandler after filters in pipeline - Other accompanying changes
Diffstat (limited to 'src/org/traccar/reports/Summary.java')
-rw-r--r--src/org/traccar/reports/Summary.java25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/org/traccar/reports/Summary.java b/src/org/traccar/reports/Summary.java
index dac8afe67..e2c11e7b1 100644
--- a/src/org/traccar/reports/Summary.java
+++ b/src/org/traccar/reports/Summary.java
@@ -47,15 +47,14 @@ public final class Summary {
if (firstPosition == null) {
firstPosition = position;
}
- if (previousPosition != null) {
- if (position.getAttributes().get(Position.KEY_IGNITION) != null
- && Boolean.parseBoolean(position.getAttributes().get(Position.KEY_IGNITION).toString())
- && previousPosition.getAttributes().get(Position.KEY_IGNITION) != null
- && Boolean.parseBoolean(previousPosition.getAttributes()
- .get(Position.KEY_IGNITION).toString())) {
- result.addEngineHours(position.getFixTime().getTime()
- - previousPosition.getFixTime().getTime());
- }
+ if (previousPosition != null
+ && position.getAttributes().get(Position.KEY_IGNITION) != null
+ && Boolean.parseBoolean(position.getAttributes().get(Position.KEY_IGNITION).toString())
+ && previousPosition.getAttributes().get(Position.KEY_IGNITION) != null
+ && Boolean.parseBoolean(previousPosition.getAttributes()
+ .get(Position.KEY_IGNITION).toString())) {
+ result.addEngineHours(position.getFixTime().getTime()
+ - previousPosition.getFixTime().getTime());
}
previousPosition = position;
speedSum += position.getSpeed();
@@ -65,10 +64,10 @@ public final class Summary {
&& previousPosition.getAttributes().containsKey(Position.KEY_ODOMETER)) {
result.setDistance(((Double) previousPosition.getAttributes().get(Position.KEY_ODOMETER)
- (Double) firstPosition.getAttributes().get(Position.KEY_ODOMETER)) * 1000);
- } else if (firstPosition.getAttributes().containsKey(Position.KEY_DISTANCE)
- && previousPosition.getAttributes().containsKey(Position.KEY_DISTANCE)) {
- result.setDistance((Double) previousPosition.getAttributes().get(Position.KEY_DISTANCE)
- - (Double) firstPosition.getAttributes().get(Position.KEY_DISTANCE));
+ } else if (firstPosition.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE)
+ && previousPosition.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE)) {
+ result.setDistance((Double) previousPosition.getAttributes().get(Position.KEY_TOTAL_DISTANCE)
+ - (Double) firstPosition.getAttributes().get(Position.KEY_TOTAL_DISTANCE));
}
result.setAverageSpeed(speedSum / positions.size());