diff --git a/core/section/github/commits.go b/core/section/github/commits.go
index 56e0c403..fbb2dbe5 100644
--- a/core/section/github/commits.go
+++ b/core/section/github/commits.go
@@ -42,10 +42,12 @@ type githubCommit struct {
}
type githubAuthorStats struct {
- Author string `json:"author"`
- Avatar string `json:"avatar"`
- CommitCount int `json:"commitCount"`
- //TotalChanges int `json:"totalChanges"`
+ Author string `json:"author"`
+ Avatar string `json:"avatar"`
+ CommitCount int `json:"commitCount"`
+ Repos []string `json:"repos"`
+ OpenIssues int `json:"openIssues"`
+ ClosedIssues int `json:"closedIssues"`
}
// sort stats in order that that should be presented.
@@ -61,13 +63,16 @@ const tagCommitsData = "commitsData"
func init() {
reports[tagCommitsData] = report{refreshCommits, renderCommits, `
-
- {{.CommitCount}} commits since {{.Config.Since}}{{.Config.DateMessage}} |
+ |
Author |
+ Open Issues |
+ Closed Issues |
#commits |
+ Branches |
{{range $stats := .AuthorStats}}
@@ -77,7 +82,14 @@ func init() {
{{$stats.Author}} |
+ {{$stats.OpenIssues}} |
+ {{$stats.ClosedIssues}} |
{{$stats.CommitCount}} |
+
+ {{range $repo := $stats.Repos}}
+ {{$repo}}
+ {{end}}
+ |
{{end}}
@@ -117,6 +129,8 @@ func getCommits(client *gogithub.Client, config *githubConfig) ([]githubBranchCo
authorStats := make(map[string]githubAuthorStats)
+ contribBranch := make(map[string]map[string]struct{})
+
overall := []githubBranchCommits{}
for _, orb := range config.Lists {
@@ -136,14 +150,12 @@ func getCommits(client *gogithub.Client, config *githubConfig) ([]githubBranchCo
return nil, nil, err
}
- if len(guff) == 0 {
- return []githubBranchCommits{}, []githubAuthorStats{}, nil
- }
-
day := ""
newDay := ""
ret := []githubDayCommits{}
+ thisBranch := fmt.Sprintf("%s/%s:%s", orb.Owner, orb.Repo, orb.Name)
+
for k, v := range guff {
if guff[k].Commit != nil {
@@ -221,10 +233,15 @@ func getCommits(client *gogithub.Client, config *githubConfig) ([]githubBranchCo
Avatar: aa,
URL: template.URL(u),
})
+
+ if _, ok := contribBranch[al]; !ok {
+ contribBranch[al] = make(map[string]struct{})
+ }
+ contribBranch[al][thisBranch] = struct{}{}
}
overall = append(overall, githubBranchCommits{
- Name: fmt.Sprintf("%s/%s:%s", orb.Owner, orb.Repo, orb.Name),
+ Name: thisBranch,
URL: fmt.Sprintf("https://github.com/%s/%s/tree/%s", orb.Owner, orb.Repo, orb.Name),
Days: ret,
})
@@ -233,6 +250,12 @@ func getCommits(client *gogithub.Client, config *githubConfig) ([]githubBranchCo
retStats := make([]githubAuthorStats, 0, len(authorStats))
for _, v := range authorStats {
+ repos := contribBranch[v.Author]
+ v.Repos = make([]string, 0, len(repos))
+ for r := range repos {
+ v.Repos = append(v.Repos, r)
+ }
+ sort.Strings(v.Repos)
retStats = append(retStats, v)
}
sort.Stable(asToSort(retStats))
@@ -260,5 +283,18 @@ func renderCommits(payload *githubRender, c *githubConfig) error {
payload.CommitCount += len(day.Commits)
}
}
+
+ for a := range payload.AuthorStats {
+ for i := range payload.Issues {
+ if payload.AuthorStats[a].Author == payload.Issues[i].Name {
+ if payload.Issues[i].IsOpen {
+ payload.AuthorStats[a].OpenIssues++
+ } else {
+ payload.AuthorStats[a].ClosedIssues++
+ }
+ }
+ }
+ }
+
return nil
}
diff --git a/core/section/github/issues.go b/core/section/github/issues.go
index b71fb856..dd5488d1 100644
--- a/core/section/github/issues.go
+++ b/core/section/github/issues.go
@@ -22,16 +22,17 @@ import (
)
type githubIssue struct {
- ID int `json:"id"`
- Date string `json:"date"`
- Updated string `json:"dated"`
- Message string `json:"message"`
- URL template.URL `json:"url"`
- Name string `json:"name"`
- Avatar string `json:"avatar"`
- Labels template.HTML `json:"labels"`
- IsOpen bool `json:"isopen"`
- Repo string `json:"repo"`
+ ID int `json:"id"`
+ Date string `json:"date"`
+ Updated string `json:"dated"`
+ Message string `json:"message"`
+ URL template.URL `json:"url"`
+ Name string `json:"name"`
+ Avatar string `json:"avatar"`
+ Labels template.HTML `json:"labels"`
+ LabelNames []string `json:"labelNames"`
+ IsOpen bool `json:"isopen"`
+ Repo string `json:"repo"`
}
// sort issues in order that that should be presented - by date updated.
@@ -73,7 +74,7 @@ const (
func init() {
reports[tagIssuesData] = report{refreshIssues, renderIssues, `
-
Issues
+
Issues: {{.ClosedIssues}} closed, {{.OpenIssues}} open
{{if .ShowList}}
Including issues labelled
@@ -97,9 +98,9 @@ func init() {
{{end}}
-
{{$data.Message}} {{$data.Labels}}
+
{{$data.Repo}} - {{$data.Message}} {{$data.Labels}}
- #{{$data.ID}} opened on {{$data.Date}} by {{$data.Name}} in {{$data.Repo}}, last updated {{$data.Updated}}
+ #{{$data.ID}} opened on {{$data.Date}} by {{$data.Name}}, last updated {{$data.Updated}}
@@ -112,12 +113,13 @@ func init() {
`}
}
-func wrapLabels(labels []gogithub.Label) string {
- l := ""
+func wrapLabels(labels []gogithub.Label) (l string, labelNames []string) {
+ labelNames = make([]string, 0, len(labels))
for _, ll := range labels {
+ labelNames = append(labelNames, *ll.Name)
l += `
` + *ll.Name + ` `
}
- return l
+ return l, labelNames
}
func getIssues(client *gogithub.Client, config *githubConfig) ([]githubIssue, error) {
@@ -166,17 +168,18 @@ func getIssues(client *gogithub.Client, config *githubConfig) ([]githubIssue, er
n = *ptr.Login
}
}
- l := wrapLabels(v.Labels)
+ l, ln := wrapLabels(v.Labels)
ret = append(ret, githubIssue{
- Name: n,
- Message: *v.Title,
- Date: v.CreatedAt.Format(issuesTimeFormat),
- Updated: v.UpdatedAt.Format(issuesTimeFormat),
- URL: template.URL(*v.HTMLURL),
- Labels: template.HTML(l),
- ID: *v.Number,
- IsOpen: *v.State == "open",
- Repo: rName,
+ Name: n,
+ Message: *v.Title,
+ Date: v.CreatedAt.Format(issuesTimeFormat),
+ Updated: v.UpdatedAt.Format(issuesTimeFormat),
+ URL: template.URL(*v.HTMLURL),
+ Labels: template.HTML(l),
+ LabelNames: ln,
+ ID: *v.Number,
+ IsOpen: *v.State == "open",
+ Repo: rName,
})
}
}
@@ -201,12 +204,32 @@ func refreshIssues(gr *githubRender, config *githubConfig, client *gogithub.Clie
gr.OpenIssues = 0
gr.ClosedIssues = 0
+ sharedLabels := make(map[string][]string)
for _, v := range gr.Issues {
if v.IsOpen {
gr.OpenIssues++
} else {
gr.ClosedIssues++
}
+ for _, lab := range v.LabelNames {
+ sharedLabels[lab] = append(sharedLabels[lab], v.Repo)
+ }
+ }
+
+ gr.SharedLabels = make([]template.HTML, 0, len(sharedLabels)) // will usually be too big
+ for name, repos := range sharedLabels {
+ if len(repos) > 1 {
+ lab := name + ":["
+ for i, r := range repos {
+ if i > 0 {
+ lab += " "
+ }
+ lab += "
" + r + ""
+ }
+ lab += "] "
+ gr.SharedLabels = append(gr.SharedLabels, template.HTML(lab))
+ }
}
return nil
diff --git a/core/section/github/milestones.go b/core/section/github/milestones.go
index 86f6cf0b..7cc57d0d 100644
--- a/core/section/github/milestones.go
+++ b/core/section/github/milestones.go
@@ -31,6 +31,7 @@ type githubMilestone struct {
CompleteMsg string `json:"completeMsg"`
DueDate string `json:"dueDate"`
UpdatedAt string `json:"updatedAt"`
+ Progress uint `json:"progress"`
}
// sort milestones in order that that should be presented - by date updated.
@@ -79,7 +80,7 @@ const (
func init() {
reports[tagMilestonesData] = report{refreshMilestones, renderMilestones, `
-
Milestones
+
Milestones: {{.ClosedMS}} closed, {{.OpenMS}} open
{{range $data := .Milestones}}
@@ -93,7 +94,9 @@ func init() {
{{end}}
-
{{$data.Repo}} - {{$data.Name}}
+
{{$data.Repo}} - {{$data.Name}}
+