aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-04-21 15:52:44 -0700
committerAnton Tananaev <anton@traccar.org>2024-04-21 15:52:44 -0700
commit35ae557526d8613e9658375e7f846e644fca4d83 (patch)
treeb11243752062a3e7efe2deb76ca8fde5bdae6841 /src
parent8e4e92f84f149ec9f9da6dd601fab06ed55c544c (diff)
downloadtrackermap-server-35ae557526d8613e9658375e7f846e644fca4d83.tar.gz
trackermap-server-35ae557526d8613e9658375e7f846e644fca4d83.tar.bz2
trackermap-server-35ae557526d8613e9658375e7f846e644fca4d83.zip
Hide missing values in reports
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/reports/SummaryReportProvider.java14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/main/java/org/traccar/reports/SummaryReportProvider.java b/src/main/java/org/traccar/reports/SummaryReportProvider.java
index ffde0b067..5f155552b 100644
--- a/src/main/java/org/traccar/reports/SummaryReportProvider.java
+++ b/src/main/java/org/traccar/reports/SummaryReportProvider.java
@@ -105,15 +105,9 @@ public class SummaryReportProvider {
result.setDistance(PositionUtil.calculateDistance(first, last, !ignoreOdometer));
result.setSpentFuel(reportUtils.calculateFuel(first, last));
- long durationMilliseconds;
if (first.hasAttribute(Position.KEY_HOURS) && last.hasAttribute(Position.KEY_HOURS)) {
- durationMilliseconds = last.getLong(Position.KEY_HOURS) - first.getLong(Position.KEY_HOURS);
+ long durationMilliseconds = last.getLong(Position.KEY_HOURS) - first.getLong(Position.KEY_HOURS);
result.setEngineHours(durationMilliseconds);
- } else {
- durationMilliseconds = last.getFixTime().getTime() - first.getFixTime().getTime();
- }
-
- if (durationMilliseconds > 0) {
result.setAverageSpeed(UnitsConverter.knotsFromMps(result.getDistance() * 1000 / durationMilliseconds));
}
@@ -142,15 +136,13 @@ public class SummaryReportProvider {
if (daily) {
while (from.truncatedTo(ChronoUnit.DAYS).isBefore(to.truncatedTo(ChronoUnit.DAYS))) {
ZonedDateTime fromDay = from.truncatedTo(ChronoUnit.DAYS);
- ZonedDateTime nextDay = fromDay.plus(1, ChronoUnit.DAYS);
+ ZonedDateTime nextDay = fromDay.plusDays(1);
results.addAll(calculateDeviceResult(
device, Date.from(from.toInstant()), Date.from(nextDay.toInstant()), fast));
from = nextDay;
}
- results.addAll(calculateDeviceResult(device, Date.from(from.toInstant()), Date.from(to.toInstant()), fast));
- } else {
- results.addAll(calculateDeviceResult(device, Date.from(from.toInstant()), Date.from(to.toInstant()), fast));
}
+ results.addAll(calculateDeviceResult(device, Date.from(from.toInstant()), Date.from(to.toInstant()), fast));
return results;
}