func (a AuditData) GetSummaryByCategory() CountSummaryByCategory {
	summaries := CountSummaryByCategory{}
	for _, ctrlResult := range a.Results {
		if ctrlResult.PodResult != nil {
			summaries.AddSummary(ctrlResult.GetSummaryByCategory())
		}
	}
	return summaries
}
GetSummaryByCategory summarizes AuditData
package validator
import (
	"sort"
	"strings"
	"github.com/fairwindsops/polaris/pkg/config"
)
type CountSummary struct {
	Successes uint
	Warnings  uint
	Dangers   uint
}
type CountSummaryByCategory map[string]CountSummary
func (cs CountSummary) GetScore() uint {
	total := (cs.Successes * 2) + cs.Warnings + (cs.Dangers * 2)
	if total == 0 {
		return uint(100)
	}
	score := uint((float64(cs.Successes*2) / float64(total)) * 100)
	return score
}
func (cs *CountSummary) AddSummary(other CountSummary) {
	cs.Successes += other.Successes
	cs.Warnings += other.Warnings
	cs.Dangers += other.Dangers
}
func (cs *CountSummary) AddResult(result ResultMessage) {
	if result.Success == false {
		if result.Severity == config.SeverityWarning {
			cs.Warnings++
		} else {
			cs.Dangers++
		}
	} else {
		cs.Successes++
	}
}
func (csc CountSummaryByCategory) AddSummary(other CountSummaryByCategory) {
	categories := []string{}
	for cat := range csc {
		categories = append(categories, cat)
	}
	for cat := range other {
		categories = append(categories, cat)
	}
	for _, cat := range categories {
		cur := csc[cat]
		cur.AddSummary(other[cat])
		csc[cat] = cur
	}
}
func (rs ResultSet) GetSummary() CountSummary {
	cs := CountSummary{}
	for _, result := range rs {
		cs.AddResult(result)
	}
	return cs
}
func (rs ResultSet) GetSummaryByCategory() CountSummaryByCategory {
	summaries := CountSummaryByCategory{}
	for _, result := range rs {
		cs, ok := summaries[result.Category]
		if !ok {
			cs = CountSummary{}
		}
		cs.AddResult(result)
		summaries[result.Category] = cs
	}
	return summaries
}
func (p PodResult) GetSummary() CountSummary {
	summary := p.Results.GetSummary()
	for _, containerResult := range p.ContainerResults {
		summary.AddSummary(containerResult.Results.GetSummary())
	}
	return summary
}
func (p PodResult) GetSummaryByCategory() CountSummaryByCategory {
	summaries := p.Results.GetSummaryByCategory()
	for _, containerResult := range p.ContainerResults {
		summaries.AddSummary(containerResult.Results.GetSummaryByCategory())
	}
	return summaries
}
func (c Result) GetSummary() CountSummary {
	summary := c.Results.GetSummary()
	if c.PodResult != nil {
		summary.AddSummary(c.PodResult.GetSummary())
	}
	return summary
}
func (c Result) GetSummaryByCategory() CountSummaryByCategory {
	summary := c.Results.GetSummaryByCategory()
	if c.PodResult != nil {
		summary.AddSummary(c.PodResult.GetSummaryByCategory())
	}
	return summary
}
func (a AuditData) GetSummary() CountSummary {
	summary := CountSummary{}
	for _, res := range a.Results {
		summary.AddSummary(res.GetSummary())
	}
	return summary
}