aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/reports
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-03-14 22:24:17 +1300
committerGitHub <noreply@github.com>2017-03-14 22:24:17 +1300
commite85f2a54420aa1299ea70b0bcf4a0c870620a31a (patch)
tree6a0ce5ded2fd24e5cf98f5e5f04095a03593105d /src/org/traccar/reports
parentb3e2f211c3a3c64c8fa704ba1942970bb97f8eae (diff)
parent1b499620810fe6d376a4a72c5ab66b6be2f4af5c (diff)
downloadtrackermap-server-e85f2a54420aa1299ea70b0bcf4a0c870620a31a.tar.gz
trackermap-server-e85f2a54420aa1299ea70b0bcf4a0c870620a31a.tar.bz2
trackermap-server-e85f2a54420aa1299ea70b0bcf4a0c870620a31a.zip
Merge pull request #3001 from Abyss777/timezone
Timezone field to User and Server model
Diffstat (limited to 'src/org/traccar/reports')
-rw-r--r--src/org/traccar/reports/ReportUtils.java18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java
index 1402e10d4..ed97c6857 100644
--- a/src/org/traccar/reports/ReportUtils.java
+++ b/src/org/traccar/reports/ReportUtils.java
@@ -24,6 +24,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.TimeZone;
public final class ReportUtils {
@@ -31,19 +32,16 @@ public final class 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";
+ return (String) Context.getPermissionsManager().lookupPreference(userId, "distanceUnit", "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";
+ return (String) Context.getPermissionsManager().lookupPreference(userId, "speedUnit", "kn");
+ }
+
+ public static TimeZone getTimezone(long userId) {
+ String timezone = (String) Context.getPermissionsManager().lookupPreference(userId, "timezone", null);
+ return timezone != null ? TimeZone.getTimeZone(timezone) : TimeZone.getDefault();
}
public static Collection<Long> getDeviceList(Collection<Long> deviceIds, Collection<Long> groupIds) {