Author: Paolo Lulli <paolo@lulli.net>
Substring filter
server/rest/rest-metric.go | 3 ++- server/rest/rest-position.go | 3 ++-
diff --git a/server/rest/rest-metric.go b/server/rest/rest-metric.go index 762a6bc3dd5a8af04a1287f9949c631cb2e30fb8..9b03ce390b26b980ba7e8cf461fdebffaa4f35bf 100644 --- a/server/rest/rest-metric.go +++ b/server/rest/rest-metric.go @@ -17,6 +17,7 @@ "log" "net/http" "os" "strconv" + "strings" "time" "yats-server/config" "yats-server/db" @@ -109,7 +110,7 @@ fromString := fromUnixTimeUTC.UTC().String() toString := toUnixTimeUTC.UTC().String() fmt.Println("PASSING HERE, from:" + fromString + " to:" + toString) //LOG.Printf("PASSING HERE, from %s to %s\n", fromString, toString) - metricsPack = db.MetricsBetween(db.Session, clientCN, metric.Name, fromString, toString, 100) + metricsPack = db.MetricsBetween(db.Session, clientCN, metric.Name, strings.TrimSpace(fromString[0:19]), strings.TrimSpace(toString[0:19]), 100) } c.IndentedJSON(http.StatusAccepted, gin.H{"ret": "OK", "data": metricsPack}) } diff --git a/server/rest/rest-position.go b/server/rest/rest-position.go index b61c0a9b24829e12c44b585177266e1bc1985662..b144c10f35d9727a65bb2333d8497bb0c9cded27 100644 --- a/server/rest/rest-position.go +++ b/server/rest/rest-position.go @@ -5,6 +5,7 @@ "fmt" "github.com/gin-gonic/gin" "net/http" "strconv" + "strings" "time" "yats-server/config" "yats-server/db" @@ -119,7 +120,7 @@ var eventsPack []model.EventModel unixTimeUTC := time.Unix(fromParamInt64, 0) timeString := unixTimeUTC.UTC().String() - eventsPack = db.EventsFrom(db.Session, clientCN, timeString, 100) + eventsPack = db.EventsFrom(db.Session, clientCN, strings.TrimSpace(timeString[0:19]), 100) c.IndentedJSON(http.StatusAccepted, gin.H{"ret": "OK", "data": eventsPack}) }