From 2fcc1ba1d632a813b3e664a092500ea70caa234d Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 15 Jan 2024 13:32:46 +0100 Subject: wip --- cmd/ursrv/aggregate/analytics.go | 6 +++--- cmd/ursrv/report/aggregation_report.go | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/cmd/ursrv/aggregate/analytics.go b/cmd/ursrv/aggregate/analytics.go index eb9e6acd0d..fb14ee4bbe 100644 --- a/cmd/ursrv/aggregate/analytics.go +++ b/cmd/ursrv/aggregate/analytics.go @@ -150,8 +150,8 @@ next: if res[i].Key == group { res[i].Count += a.Count res[i].Percentage += a.Percentage - if len(res[i].Items) < perGroup { - res[i].Items = append(res[i].Items, a) + if len(res[i].Children) < perGroup { + res[i].Children = append(res[i].Children, a) } continue next } @@ -160,7 +160,7 @@ next: Key: group, Count: a.Count, Percentage: a.Percentage, - Items: []report.Analytic{a}, + Children: []report.Analytic{a}, }) } diff --git a/cmd/ursrv/report/aggregation_report.go b/cmd/ursrv/report/aggregation_report.go index 75a0767320..b096e31a6b 100644 --- a/cmd/ursrv/report/aggregation_report.go +++ b/cmd/ursrv/report/aggregation_report.go @@ -13,8 +13,8 @@ import ( type AggregatedReport struct { Date time.Time `json:"date"` - Features map[string][]Feature `json:"Features"` - FeatureGroups map[string][]FeatureGroup `json:"FeatureGroups"` + Features map[string][]Feature `json:"features"` + FeatureGroups map[string][]FeatureGroup `json:"featureGroups"` Nodes int `json:"nodes"` VersionNodes map[string]int `json:"versionNodes"` Categories []Category `json:"categories"` @@ -35,9 +35,8 @@ type AggregatedReport struct { type Category struct { Values [4]float64 `json:"values"` - Key string `json:"key"` Descr string `json:"descr"` - Unit string `json:"unit"` + Unit string `json:"unit,omitempty"` Type NumberType `json:"type"` } @@ -68,7 +67,7 @@ type Analytic struct { Key string `json:"key"` Count int `json:"count"` Percentage float64 `json:"percentage"` - Items []Analytic `json:"items"` + Children []Analytic `json:"children,omitempty"` } type Performance struct { @@ -117,7 +116,6 @@ func (lm *LocationMap) Add(lat, lon float64) { loc.Inc() } else { loc = Location{Latitude: lat, Longitude: lon, Count: 1} - } lm.mapped[id] = loc } -- cgit v1.2.3