diff --git a/server/http_session_handler.go b/server/http_session_handler.go index b83fb3a7d..49f6c6c8c 100644 --- a/server/http_session_handler.go +++ b/server/http_session_handler.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + "math" "net/http" "strconv" @@ -50,9 +51,10 @@ func sessionHandler(w http.ResponseWriter, r *http.Request) { if month != "" { iMonth, err := strconv.Atoi(month) if err != nil { - jsonError(w, http.StatusInternalServerError, err) + jsonError(w, http.StatusBadRequest, err) return } + fmtMonth = fmt.Sprintf("%02d", iMonth) filename += "." + fmtMonth } @@ -64,6 +66,11 @@ func sessionHandler(w http.ResponseWriter, r *http.Request) { return } + // prepare data + for _, s := range res { + s.Odometer = math.Round(s.Odometer*10) / 10 + } + if r.URL.Query().Get("format") == "csv" { lang := r.URL.Query().Get("lang") if lang == "" {