diff options
Diffstat (limited to 'src/org/traccar/reports/ReportUtils.java')
-rw-r--r-- | src/org/traccar/reports/ReportUtils.java | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java index 6cbda0ede..7fcc767e9 100644 --- a/src/org/traccar/reports/ReportUtils.java +++ b/src/org/traccar/reports/ReportUtils.java @@ -16,20 +16,36 @@ */ package org.traccar.reports; +import org.traccar.Context; +import org.traccar.helper.Log; +import org.traccar.model.Position; + import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; import java.util.Collection; -import org.traccar.Context; -import org.traccar.helper.Log; -import org.traccar.model.Position; - public final class ReportUtils { private ReportUtils() { } + public static String getDistanceUnit(long userId) { + String unit = Context.getPermissionsManager().getUser(userId).getDistanceUnit(); + if (unit == null) { + unit = Context.getPermissionsManager().getServer().getDistanceUnit(); + } + return unit != null ? unit : "km"; + } + + public static String getSpeedUnit(long userId) { + String unit = Context.getPermissionsManager().getUser(userId).getSpeedUnit(); + if (unit == null) { + unit = Context.getPermissionsManager().getServer().getSpeedUnit(); + } + return unit != null ? unit : "kn"; + } + public static Collection<Long> getDeviceList(Collection<Long> deviceIds, Collection<Long> groupIds) { Collection<Long> result = new ArrayList<>(); result.addAll(deviceIds); |