From 87ec6d2affe9600dcc7d28fa1debd4d2cc9b24fe Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Thu, 3 Nov 2016 23:55:37 -0700 Subject: removing bug to eliminate repetitive labels --- system/api/analytics/init.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'system/api/analytics/init.go') 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) { -- cgit v1.2.3