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

feat: project details page with branch statistics (resolve #242)

This commit is contained in:
Ferdinand Mütsch
2022-01-02 20:04:29 +01:00
parent bb0d0569fd
commit c2d3426bcd
15 changed files with 801 additions and 672 deletions

View File

@ -56,6 +56,7 @@ type SummaryParams struct {
From time.Time
To time.Time
User *User
Filters *Filters
Recompute bool
}
@ -304,6 +305,26 @@ func (s *Summary) findFirstPresentType() (uint8, error) {
return 127, errors.New("no type present")
}
func (s *SummaryParams) HasFilters() bool {
return s.Filters != nil && !s.Filters.IsEmpty()
}
func (s *SummaryParams) IsProjectDetails() bool {
if !s.HasFilters() {
return false
}
_, entity, filters := s.Filters.One()
return entity == SummaryProject && len(filters) == 1 // exactly one
}
func (s *SummaryParams) GetProjectFilter() string {
if !s.IsProjectDetails() {
return ""
}
_, _, filters := s.Filters.One()
return filters[0]
}
func (s *SummaryItem) TotalFixed() time.Duration {
// this is a workaround, since currently, the total time of a summary item is mistakenly represented in seconds
// TODO: fix some day, while migrating persisted summary items