1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 15:49:44 +02:00

change Trello activity reporting to be more concise

This commit is contained in:
Elliott Stoneham 2016-09-15 17:08:51 +01:00
parent cf01d9365a
commit 44716e8b9e
3 changed files with 26 additions and 11 deletions

View file

@ -601,9 +601,8 @@ func buildPayloadAnalysis(config *trelloConfig, render *trelloRender) {
}
// ActionSummary
if render.Boards[brdIdx].ActionSummary == nil {
render.Boards[brdIdx].ActionSummary = make(map[string]int)
}
actionSummaryMap := make(map[string]int)
for _, act := range brd.Actions {
englishType := ""
for _, c := range act.Type {
@ -619,9 +618,20 @@ func buildPayloadAnalysis(config *trelloConfig, render *trelloRender) {
englishType = newTxt
}
if len(englishType) > 0 {
render.Boards[brdIdx].ActionSummary[englishType]++
actionSummaryMap[englishType]++
}
}
acts := make([]string, 0, len(actionSummaryMap))
for a := range actionSummaryMap {
acts = append(acts, a)
}
sort.Strings(acts)
render.Boards[brdIdx].ActionSummary = make([]trelloActionSummaryEntry, len(acts))
for k, v := range acts {
render.Boards[brdIdx].ActionSummary[k] = trelloActionSummaryEntry{Name: v, Count: actionSummaryMap[v]}
}
}
//post-process labels