diff options
author | Abyss777 <abyss@fox5.ru> | 2016-08-19 10:45:33 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-08-19 10:45:33 +0500 |
commit | 1c7437d6de01fffbe3f69853717808b1790413fd (patch) | |
tree | ae6fa7144b30321e754773af4a2d464c9e52c624 /src/org/traccar/reports/Summary.java | |
parent | 3826a93f1009942e22ec80c1e13be71e8e917b01 (diff) | |
download | trackermap-server-1c7437d6de01fffbe3f69853717808b1790413fd.tar.gz trackermap-server-1c7437d6de01fffbe3f69853717808b1790413fd.tar.bz2 trackermap-server-1c7437d6de01fffbe3f69853717808b1790413fd.zip |
- Added trips report
- Refactored reports models
- Added tests for ReportUtils
- Added speed to test-generator.py
- Other changes
Diffstat (limited to 'src/org/traccar/reports/Summary.java')
-rw-r--r-- | src/org/traccar/reports/Summary.java | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/src/org/traccar/reports/Summary.java b/src/org/traccar/reports/Summary.java index 402e6d432..44fb1dd4c 100644 --- a/src/org/traccar/reports/Summary.java +++ b/src/org/traccar/reports/Summary.java @@ -16,8 +16,6 @@ */ package org.traccar.reports; -import java.math.BigDecimal; -import java.math.RoundingMode; import java.sql.SQLException; import java.util.Collection; import java.util.Date; @@ -62,22 +60,8 @@ public final class Summary { speedSum += position.getSpeed(); result.setMaxSpeed(position.getSpeed()); } - if (firstPosition.getAttributes().containsKey(Position.KEY_ODOMETER) - && previousPosition.getAttributes().containsKey(Position.KEY_ODOMETER)) { - result.setDistance((Integer.parseInt(previousPosition.getAttributes().get(Position.KEY_ODOMETER) - .toString()) - - Integer.parseInt(firstPosition.getAttributes().get(Position.KEY_ODOMETER).toString())) - * 1000); - } else if (firstPosition.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE) - && previousPosition.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE)) { - result.setDistance(((Number) previousPosition.getAttributes().get(Position.KEY_TOTAL_DISTANCE)) - .doubleValue() - - ((Number) firstPosition.getAttributes().get(Position.KEY_TOTAL_DISTANCE)).doubleValue()); - } - result.setDistance(new BigDecimal(result.getDistance()) - .setScale(2, RoundingMode.HALF_EVEN).doubleValue()); - result.setAverageSpeed(new BigDecimal(speedSum / positions.size()) - .setScale(3, RoundingMode.HALF_EVEN).doubleValue()); + result.setDistance(ReportUtils.calculateDistance(firstPosition, previousPosition)); + result.setAverageSpeed(speedSum / positions.size()); } return result; } |