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

feat: implement file statistics (resolve #80)

This commit is contained in:
Ferdinand Mütsch
2023-03-22 20:45:27 +01:00
parent 0cf09a0871
commit 4ee3da6f7e
18 changed files with 1324 additions and 1138 deletions

View File

@@ -35,6 +35,7 @@ type SummariesData struct {
OperatingSystems []*SummariesEntry `json:"operating_systems"`
Projects []*SummariesEntry `json:"projects"`
Branches []*SummariesEntry `json:"branches,omitempty"`
Entities []*SummariesEntry `json:"entities,omitempty"`
GrandTotal *SummariesGrandTotal `json:"grand_total"`
Range *SummariesRange `json:"range"`
}
@@ -132,8 +133,8 @@ func newDataFrom(s *models.Summary) *SummariesData {
}
var wg sync.WaitGroup
wg.Add(6)
wg.Add(1)
go func(data *SummariesData) {
defer wg.Done()
for i, e := range s.Projects {
@@ -141,6 +142,7 @@ func newDataFrom(s *models.Summary) *SummariesData {
}
}(data)
wg.Add(1)
go func(data *SummariesData) {
defer wg.Done()
for i, e := range s.Editors {
@@ -148,6 +150,7 @@ func newDataFrom(s *models.Summary) *SummariesData {
}
}(data)
wg.Add(1)
go func(data *SummariesData) {
defer wg.Done()
for i, e := range s.Languages {
@@ -155,6 +158,7 @@ func newDataFrom(s *models.Summary) *SummariesData {
}
}(data)
wg.Add(1)
go func(data *SummariesData) {
defer wg.Done()
for i, e := range s.OperatingSystems {
@@ -162,6 +166,7 @@ func newDataFrom(s *models.Summary) *SummariesData {
}
}(data)
wg.Add(1)
go func(data *SummariesData) {
defer wg.Done()
for i, e := range s.Machines {
@@ -169,6 +174,7 @@ func newDataFrom(s *models.Summary) *SummariesData {
}
}(data)
wg.Add(1)
go func(data *SummariesData) {
defer wg.Done()
for i, e := range s.Branches {
@@ -176,9 +182,20 @@ func newDataFrom(s *models.Summary) *SummariesData {
}
}(data)
wg.Add(1)
go func(data *SummariesData) {
defer wg.Done()
for i, e := range s.Entities {
data.Entities[i] = convertEntry(e, s.TotalTimeBy(models.SummaryEntity))
}
}(data)
if s.Branches == nil {
data.Branches = nil
}
if s.Entities == nil {
data.Entities = nil
}
wg.Wait()
return data