summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-11-03 23:55:37 -0700
committerSteve Manuel <nilslice@gmail.com>2016-11-03 23:55:37 -0700
commit87ec6d2affe9600dcc7d28fa1debd4d2cc9b24fe (patch)
treee2803980ad85fd8f16640b10c7ab815294251df5
parent594bb855814b198a3a8c337fc0788753d921b39e (diff)
removing bug to eliminate repetitive labels
-rw-r--r--system/api/analytics/init.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/system/api/analytics/init.go b/system/api/analytics/init.go
index 6fb43a4..3a78e90 100644
--- a/system/api/analytics/init.go
+++ b/system/api/analytics/init.go
@@ -124,6 +124,12 @@ func Week() (map[string]string, error) {
times[len(times)-1-i] = day
}
+ dates := []string{}
+ for i := range times {
+ // format times[j] (time.Time) into a MM/DD format for dates
+ dates = append(dates, times[i].Format("01/02"))
+ }
+
// get api request analytics from db
var requests = []apiRequest{}
err := store.View(func(tx *bolt.Tx) error {
@@ -151,7 +157,6 @@ func Week() (map[string]string, error) {
return nil, err
}
- dates := []string{}
ips := [7]map[string]struct{}{}
total := [7]int{}
unique := [7]int{}
@@ -161,9 +166,6 @@ CHECK_REQUEST:
ts := time.Unix(requests[i].Timestamp/1000, 0)
for j := range times {
- // format times[j] (time.Time) into a MM/DD format for dates
- dates = append(dates, 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
if j == len(times) {