1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

fix(perf): speed up summary retrieval of all time interval (resolve #336)

This commit is contained in:
Ferdinand Mütsch
2022-03-17 11:08:40 +01:00
parent d1bd7b96b8
commit b763c4acc6
4 changed files with 113 additions and 12 deletions

View File

@ -101,7 +101,23 @@ func (s *Summary) MappedItems() map[uint8]*SummaryItems {
}
func (s *Summary) ItemsByType(summaryType uint8) *SummaryItems {
return s.MappedItems()[summaryType]
switch summaryType {
case SummaryProject:
return &s.Projects
case SummaryLanguage:
return &s.Languages
case SummaryEditor:
return &s.Editors
case SummaryOS:
return &s.OperatingSystems
case SummaryMachine:
return &s.Machines
case SummaryLabel:
return &s.Labels
case SummaryBranch:
return &s.Branches
}
return nil
}
func (s *Summary) KeepOnly(types map[uint8]bool) *Summary {