aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/reports/Summary.java
diff options
context:
space:
mode:
authorChristoph Krey <krey.christoph@gmail.com>2018-04-16 10:50:57 +0200
committerChristoph Krey <krey.christoph@gmail.com>2018-04-16 10:50:57 +0200
commit7a0be25c49eebba92ab70c715faa987312950b7d (patch)
tree0342b16af8f8aa524b69e4a5b83476431a5e6dbc /src/org/traccar/reports/Summary.java
parent3a602dd133b533cc69d5986d64a00fb3ed670f75 (diff)
downloadtrackermap-server-7a0be25c49eebba92ab70c715faa987312950b7d.tar.gz
trackermap-server-7a0be25c49eebba92ab70c715faa987312950b7d.tar.bz2
trackermap-server-7a0be25c49eebba92ab70c715faa987312950b7d.zip
[NEW] Odometer in Reports
Diffstat (limited to 'src/org/traccar/reports/Summary.java')
-rw-r--r--src/org/traccar/reports/Summary.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/org/traccar/reports/Summary.java b/src/org/traccar/reports/Summary.java
index 366e40421..d789a0a9b 100644
--- a/src/org/traccar/reports/Summary.java
+++ b/src/org/traccar/reports/Summary.java
@@ -62,6 +62,17 @@ public final class Summary {
result.setDistance(ReportUtils.calculateDistance(firstPosition, previousPosition, !ignoreOdometer));
result.setAverageSpeed(speedSum / positions.size());
result.setSpentFuel(ReportUtils.calculateFuel(firstPosition, previousPosition));
+
+ if (!ignoreOdometer
+ && firstPosition.getDouble(Position.KEY_ODOMETER) != 0
+ && previousPosition.getDouble(Position.KEY_ODOMETER) != 0) {
+ result.setStartOdometer(firstPosition.getDouble(Position.KEY_ODOMETER));
+ result.setEndOdometer(previousPosition.getDouble(Position.KEY_ODOMETER));
+ } else {
+ result.setStartOdometer(firstPosition.getDouble(Position.KEY_TOTAL_DISTANCE));
+ result.setEndOdometer(previousPosition.getDouble(Position.KEY_TOTAL_DISTANCE));
+ }
+
}
return result;
}