Sessions: round odometer
This commit is contained in:
parent
3c67646a5b
commit
c150b2e0cc
1 changed files with 8 additions and 1 deletions
|
|
@ -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 == "" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue