diff --git a/cmd/ursrv/main.go b/cmd/ursrv/main.go index cfe12c4c..73ce7349 100644 --- a/cmd/ursrv/main.go +++ b/cmd/ursrv/main.go @@ -773,12 +773,14 @@ func transformVersion(v string) string { type summary struct { versions map[string]int // version string to count index + max map[string]int // version string to max users per day rows map[string][]int // date to list of counts } func newSummary() summary { return summary{ versions: make(map[string]int), + max: make(map[string]int), rows: make(map[string][]int), } } @@ -790,6 +792,10 @@ func (s *summary) setCount(date, version string, count int) { s.versions[version] = idx } + if s.max[version] < count { + s.max[version] = count + } + row := s.rows[date] if len(row) <= idx { old := row @@ -808,6 +814,14 @@ func (s *summary) MarshalJSON() ([]byte, error) { } sort.Strings(versions) + var filtered []string + for _, v := range versions { + if s.max[v] > 50 { + filtered = append(filtered, v) + } + } + versions = filtered + headerRow := []interface{}{"Day"} for _, v := range versions { headerRow = append(headerRow, v)