summaryrefslogtreecommitdiff
path: root/system/api/analytics/init.go
diff options
context:
space:
mode:
Diffstat (limited to 'system/api/analytics/init.go')
-rw-r--r--system/api/analytics/init.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/system/api/analytics/init.go b/system/api/analytics/init.go
index 9a5f428..95ad8f4 100644
--- a/system/api/analytics/init.go
+++ b/system/api/analytics/init.go
@@ -195,15 +195,13 @@ func ChartData() (map[string]interface{}, error) {
// delete the record in db if it belongs to a day already in metrics,
// otherwise append it to requests to be analyzed
d := time.Unix(r.Timestamp/1000, 0).Format("01/02")
- for i := range dates {
- if metrics[i].Date == d {
- err := b.Delete(k)
- if err != nil {
- return err
- }
- } else {
- requests = append(requests, r)
+ if m.Get([]byte(d)) != nil {
+ err := b.Delete(k)
+ if err != nil {
+ return err
}
+ } else {
+ requests = append(requests, r)
}
return nil