mirror of
https://github.com/documize/community.git
synced 2025-07-28 09:39:42 +02:00
change Trello activity reporting to be more concise
This commit is contained in:
parent
cf01d9365a
commit
44716e8b9e
3 changed files with 26 additions and 11 deletions
|
@ -34,13 +34,13 @@ const boardsTemplate = `
|
||||||
<!-- {{ len $b.Actions }}{{if eq 1 (len $b.Actions)}} action {{else}} actions {{end}} -->
|
<!-- {{ len $b.Actions }}{{if eq 1 (len $b.Actions)}} action {{else}} actions {{end}} -->
|
||||||
</div>
|
</div>
|
||||||
<span class="board-meta">
|
<span class="board-meta">
|
||||||
{{range $act, $tot := $b.ActionSummary}}
|
{{range $idx, $act := $b.ActionSummary}}{{if ne $idx 0}}{{- ","}} {{end}}{{$act.Count}} {{$act.Name -}}{{if ne 1 $act.Count}}{{"s" -}}{{end}}{{end}}{{if gt (len $b.Archived) 0}}, {{end}}
|
||||||
{{$tot}} {{$act}}{{if ne 1 $tot}}s{{end}},
|
|
||||||
{{end}}
|
|
||||||
{{if gt (len $b.Archived) 0}}
|
{{if gt (len $b.Archived) 0}}
|
||||||
{{len $b.Archived}} {{if eq 1 (len $b.Archived)}}card {{else}} cards {{end}}archived
|
{{len $b.Archived}} {{if eq 1 (len $b.Archived)}}card {{else}} cards {{end}}archived
|
||||||
{{else}}
|
{{else}}
|
||||||
no cards archived
|
{{if eq (len $b.ActionSummary) 0}}
|
||||||
|
no activity
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
<br>
|
<br>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -253,13 +253,18 @@ type trelloListCards struct {
|
||||||
Cards []trelloCard
|
Cards []trelloCard
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type trelloActionSummaryEntry struct {
|
||||||
|
Name string
|
||||||
|
Count int
|
||||||
|
}
|
||||||
|
|
||||||
type trelloRenderBoard struct {
|
type trelloRenderBoard struct {
|
||||||
Board trelloBoard
|
Board trelloBoard
|
||||||
Data []trelloListCards
|
Data []trelloListCards
|
||||||
CardCount int
|
CardCount int
|
||||||
ListCount int
|
ListCount int
|
||||||
Actions []trelloAction
|
Actions []trelloAction
|
||||||
ActionSummary map[string]int
|
ActionSummary []trelloActionSummaryEntry
|
||||||
Archived []trelloCard
|
Archived []trelloCard
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -601,9 +601,8 @@ func buildPayloadAnalysis(config *trelloConfig, render *trelloRender) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ActionSummary
|
// ActionSummary
|
||||||
if render.Boards[brdIdx].ActionSummary == nil {
|
actionSummaryMap := make(map[string]int)
|
||||||
render.Boards[brdIdx].ActionSummary = make(map[string]int)
|
|
||||||
}
|
|
||||||
for _, act := range brd.Actions {
|
for _, act := range brd.Actions {
|
||||||
englishType := ""
|
englishType := ""
|
||||||
for _, c := range act.Type {
|
for _, c := range act.Type {
|
||||||
|
@ -619,9 +618,20 @@ func buildPayloadAnalysis(config *trelloConfig, render *trelloRender) {
|
||||||
englishType = newTxt
|
englishType = newTxt
|
||||||
}
|
}
|
||||||
if len(englishType) > 0 {
|
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
|
//post-process labels
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue