diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-11-03 23:36:06 -0700 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-11-03 23:36:06 -0700 |
commit | 506d086823e88aa8a2213e03bdf8457c9804e09b (patch) | |
tree | c5e70567c59e2870c0835ff784ab0e3173561a88 | |
parent | 1c298375869094af85d696e49a116049755399c6 (diff) |
testing json.RawMessage to maintain quotations in dates array for js
-rw-r--r-- | system/api/analytics/init.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/system/api/analytics/init.go b/system/api/analytics/init.go index 5d9ab15..58f131d 100644 --- a/system/api/analytics/init.go +++ b/system/api/analytics/init.go @@ -4,7 +4,6 @@ package analytics import ( - "html" "log" "net/http" "strings" @@ -152,7 +151,7 @@ func Week() (map[string]string, error) { return nil, err } - dates := [7]string{} + dates := [7]json.RawMessage{} ips := [7]map[string]struct{}{} total := [7]int{} unique := [7]int{} @@ -163,7 +162,7 @@ CHECK_REQUEST: for j := range times { // format times[j] (time.Time) into a MM/DD format for dates - dates[j] = times[j].Format("01/02") + dates[j] = []byte(times[j].Format("01/02")) // if on today, there will be no next iteration to set values for // day prior so all valid requests belong to today @@ -224,7 +223,7 @@ CHECK_REQUEST: } return map[string]string{ - "dates": html.UnescapeString(string(jsDates)), + "dates": string(jsDates), "unique": string(jsUnique), "total": string(jsTotal), }, nil |