From 97a189c51817a6b1d7a86aece8a91ff378488799 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 18 Jun 2022 10:27:24 -0700 Subject: Refactor attribute lookup --- src/main/java/org/traccar/reports/StopsReportProvider.java | 3 +-- src/main/java/org/traccar/reports/SummaryReportProvider.java | 3 +-- src/main/java/org/traccar/reports/TripsReportProvider.java | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) (limited to 'src/main/java/org/traccar/reports') diff --git a/src/main/java/org/traccar/reports/StopsReportProvider.java b/src/main/java/org/traccar/reports/StopsReportProvider.java index a63d7ee21..192d7a0f7 100644 --- a/src/main/java/org/traccar/reports/StopsReportProvider.java +++ b/src/main/java/org/traccar/reports/StopsReportProvider.java @@ -57,8 +57,7 @@ public class StopsReportProvider { } private Collection detectStops(long deviceId, Date from, Date to) throws StorageException { - boolean ignoreOdometer = Context.getDeviceManager() - .lookupAttributeBoolean(deviceId, "report.ignoreOdometer", false, false, true); + boolean ignoreOdometer = config.getBoolean(Keys.REPORT_IGNORE_ODOMETER); return reportUtils.detectTripsAndStops( PositionUtil.getPositions(storage, deviceId, from, to), ignoreOdometer, StopReportItem.class); } diff --git a/src/main/java/org/traccar/reports/SummaryReportProvider.java b/src/main/java/org/traccar/reports/SummaryReportProvider.java index 86d76b4e3..f3a9786b9 100644 --- a/src/main/java/org/traccar/reports/SummaryReportProvider.java +++ b/src/main/java/org/traccar/reports/SummaryReportProvider.java @@ -74,8 +74,7 @@ public class SummaryReportProvider { result.setMaxSpeed(position.getSpeed()); } } - boolean ignoreOdometer = Context.getDeviceManager() - .lookupAttributeBoolean(deviceId, "report.ignoreOdometer", false, false, true); + boolean ignoreOdometer = config.getBoolean(Keys.REPORT_IGNORE_ODOMETER); result.setDistance(PositionUtil.calculateDistance(firstPosition, previousPosition, !ignoreOdometer)); result.setSpentFuel(reportUtils.calculateFuel(firstPosition, previousPosition)); diff --git a/src/main/java/org/traccar/reports/TripsReportProvider.java b/src/main/java/org/traccar/reports/TripsReportProvider.java index bec4c39fd..928609b9e 100644 --- a/src/main/java/org/traccar/reports/TripsReportProvider.java +++ b/src/main/java/org/traccar/reports/TripsReportProvider.java @@ -57,9 +57,7 @@ public class TripsReportProvider { } private Collection detectTrips(long deviceId, Date from, Date to) throws StorageException { - boolean ignoreOdometer = Context.getDeviceManager() - .lookupAttributeBoolean(deviceId, "report.ignoreOdometer", false, false, true); - + boolean ignoreOdometer = config.getBoolean(Keys.REPORT_IGNORE_ODOMETER); return reportUtils.detectTripsAndStops( PositionUtil.getPositions(storage, deviceId, from, to), ignoreOdometer, TripReportItem.class); } -- cgit v1.2.3