From 933247b3d2ec24d65203fae39dcafbe2c9afb87e Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 5 Aug 2016 11:58:43 +0500 Subject: - Added distance rounding - Fixed charset --- src/org/traccar/reports/General.java | 3 +++ src/org/traccar/web/CsvBuilder.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/org/traccar/reports/General.java b/src/org/traccar/reports/General.java index bcf2312b2..75194bc13 100644 --- a/src/org/traccar/reports/General.java +++ b/src/org/traccar/reports/General.java @@ -1,5 +1,7 @@ package org.traccar.reports; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.sql.SQLException; import java.util.Collection; import java.util.Date; @@ -76,6 +78,7 @@ public final class General { result.setMaxSpeed(position.getSpeed()); } result.setAverageSpeed(speedSum / positions.size()); + result.setDistance(new BigDecimal(result.getDistance()).setScale(2, RoundingMode.HALF_UP).doubleValue()); } return result; } diff --git a/src/org/traccar/web/CsvBuilder.java b/src/org/traccar/web/CsvBuilder.java index cfebec3b4..3f93ee102 100644 --- a/src/org/traccar/web/CsvBuilder.java +++ b/src/org/traccar/web/CsvBuilder.java @@ -3,6 +3,7 @@ package org.traccar.web; import java.beans.Introspector; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.Date; import java.util.Map; @@ -145,6 +146,6 @@ public class CsvBuilder { } public byte[] get() { - return String.valueOf(builder).getBytes(); + return String.valueOf(builder).getBytes(StandardCharsets.UTF_8); } } -- cgit v1.2.3