diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-09-21 23:19:23 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-21 23:19:23 +1200 |
commit | aff998db51d9fa4b66018139a4c5375a42ff42e8 (patch) | |
tree | 5aa7d8823c0ca11f0396ca11de2a6df68ebba048 /src/org/traccar/reports/Summary.java | |
parent | 9ee812366367148387f289b9977fd809e6a56786 (diff) | |
parent | fbe0190e65ee0646f6521cfca31ecfa3efa10472 (diff) | |
download | trackermap-server-aff998db51d9fa4b66018139a4c5375a42ff42e8.tar.gz trackermap-server-aff998db51d9fa4b66018139a4c5375a42ff42e8.tar.bz2 trackermap-server-aff998db51d9fa4b66018139a4c5375a42ff42e8.zip |
Merge pull request #2348 from Abyss777/ignore_odometer
Add parameter "report.ignoreOdometer"
Diffstat (limited to 'src/org/traccar/reports/Summary.java')
-rw-r--r-- | src/org/traccar/reports/Summary.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/org/traccar/reports/Summary.java b/src/org/traccar/reports/Summary.java index 44fb1dd4c..d4171f644 100644 --- a/src/org/traccar/reports/Summary.java +++ b/src/org/traccar/reports/Summary.java @@ -37,7 +37,7 @@ public final class Summary { private static SummaryReport calculateSummaryResult(long deviceId, Date from, Date to) throws SQLException { SummaryReport result = new SummaryReport(); result.setDeviceId(deviceId); - result.setDeviceName(Context.getDeviceManager().getDeviceById(deviceId).getName()); + result.setDeviceName(Context.getIdentityManager().getDeviceById(deviceId).getName()); Collection<Position> positions = Context.getDataManager().getPositions(deviceId, from, to); if (positions != null && !positions.isEmpty()) { Position firstPosition = null; @@ -60,7 +60,9 @@ public final class Summary { speedSum += position.getSpeed(); result.setMaxSpeed(position.getSpeed()); } - result.setDistance(ReportUtils.calculateDistance(firstPosition, previousPosition)); + boolean ignoreOdometer = Context.getDeviceManager() + .lookupConfigBoolean(deviceId, "report.ignoreOdometer", false); + result.setDistance(ReportUtils.calculateDistance(firstPosition, previousPosition, !ignoreOdometer)); result.setAverageSpeed(speedSum / positions.size()); } return result; |