diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-04-16 20:54:39 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-16 20:54:39 +1200 |
commit | cec76679d1128514691d643278ef66e13a58be6d (patch) | |
tree | 0342b16af8f8aa524b69e4a5b83476431a5e6dbc /src/org/traccar/reports/Summary.java | |
parent | 6d4b8df25c7e942b9ad594db9444fe15bcb16be9 (diff) | |
parent | 7a0be25c49eebba92ab70c715faa987312950b7d (diff) | |
download | trackermap-server-cec76679d1128514691d643278ef66e13a58be6d.tar.gz trackermap-server-cec76679d1128514691d643278ef66e13a58be6d.tar.bz2 trackermap-server-cec76679d1128514691d643278ef66e13a58be6d.zip |
Merge pull request #3849 from ckrey/OdometerInReportsClean
Odometer in reports clean
Diffstat (limited to 'src/org/traccar/reports/Summary.java')
-rw-r--r-- | src/org/traccar/reports/Summary.java | 11 |
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; } |