mirror of
https://github.com/documize/community.git
synced 2025-07-22 06:39:43 +02:00
Put in correct Github sub-section summary figures
This commit is contained in:
parent
d50aa23f34
commit
e737d278b9
6 changed files with 54 additions and 24 deletions
|
@ -17,7 +17,14 @@ const commitsTemplate = `
|
||||||
{{if .HasAuthorStats}}
|
{{if .HasAuthorStats}}
|
||||||
|
|
||||||
<h3>Contributors</h3>
|
<h3>Contributors</h3>
|
||||||
<p>There are 3 contributors across 6 repositories.</p>
|
<p>
|
||||||
|
There
|
||||||
|
{{if eq 1 (len .AuthorStats)}}is{{else}}are{{end}}
|
||||||
|
{{len .AuthorStats}}
|
||||||
|
{{if eq 1 (len .AuthorStats)}}contributor{{else}}contributors{{end}}
|
||||||
|
across {{.RepoCount}}
|
||||||
|
{{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}}
|
||||||
|
</p>
|
||||||
<table class="contributor-table" style="width: 100%;">
|
<table class="contributor-table" style="width: 100%;">
|
||||||
|
|
||||||
<tbody class="github">
|
<tbody class="github">
|
||||||
|
|
|
@ -30,7 +30,10 @@ const (
|
||||||
<div class="section-github-render">
|
<div class="section-github-render">
|
||||||
{{if .HasIssues}}
|
{{if .HasIssues}}
|
||||||
<h3>Issues</h3>
|
<h3>Issues</h3>
|
||||||
<p>There are {{.ClosedIssues}} closed and {{.OpenIssues}} open across 6 repositories.</p>
|
<p>
|
||||||
|
There are {{.ClosedIssues}} closed and {{.OpenIssues}} open across {{.RepoCount}}
|
||||||
|
{{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}}
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
{{if .ShowList}}
|
{{if .ShowList}}
|
||||||
Including issues labelled
|
Including issues labelled
|
||||||
|
|
|
@ -174,30 +174,34 @@ func refreshMilestones(gr *githubRender, config *githubConfig, client *gogithub.
|
||||||
|
|
||||||
func renderMilestones(payload *githubRender, c *githubConfig) error {
|
func renderMilestones(payload *githubRender, c *githubConfig) error {
|
||||||
hadRepo := make(map[string]bool)
|
hadRepo := make(map[string]bool)
|
||||||
|
payload.RepoCount = 0
|
||||||
for _, orb := range payload.List {
|
for _, orb := range payload.List {
|
||||||
rName := orb.Owner + "/" + orb.Repo
|
rName := orb.Owner + "/" + orb.Repo
|
||||||
if !hadRepo[rName] {
|
if !hadRepo[rName] {
|
||||||
|
if orb.Included {
|
||||||
|
|
||||||
issuesOpen, issuesClosed := 0, 0
|
payload.RepoCount++
|
||||||
for _, iss := range payload.Issues {
|
issuesOpen, issuesClosed := 0, 0
|
||||||
if iss.Repo == repoName(rName) {
|
for _, iss := range payload.Issues {
|
||||||
if iss.Milestone == noMilestone {
|
if iss.Repo == repoName(rName) {
|
||||||
if iss.IsOpen {
|
if iss.Milestone == noMilestone {
|
||||||
issuesOpen++
|
if iss.IsOpen {
|
||||||
} else {
|
issuesOpen++
|
||||||
issuesClosed++
|
} else {
|
||||||
|
issuesClosed++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if issuesClosed+issuesOpen > 0 {
|
||||||
if issuesClosed+issuesOpen > 0 {
|
payload.Milestones = append(payload.Milestones, githubMilestone{
|
||||||
payload.Milestones = append(payload.Milestones, githubMilestone{
|
Repo: orb.Repo, Private: orb.Private, Name: noMilestone, IsOpen: true,
|
||||||
Repo: orb.Repo, Private: orb.Private, Name: noMilestone, IsOpen: true,
|
OpenIssues: issuesOpen, ClosedIssues: issuesClosed, URL: orb.URL,
|
||||||
OpenIssues: issuesOpen, ClosedIssues: issuesClosed, URL: orb.URL,
|
})
|
||||||
})
|
}
|
||||||
}
|
|
||||||
|
|
||||||
hadRepo[rName] = true
|
hadRepo[rName] = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,17 +32,27 @@ const (
|
||||||
|
|
||||||
{{if .HasMilestones}}
|
{{if .HasMilestones}}
|
||||||
<h3>Milestones</h3>
|
<h3>Milestones</h3>
|
||||||
<p>There is {{.ClosedMS}} milestone closed and {{.OpenMS}} milestone open across #number repositories.</p>
|
<p>
|
||||||
|
There are
|
||||||
|
{{.ClosedMS}}
|
||||||
|
{{if eq 1 .ClosedMS}} milestone {{else}} milestones {{end}}
|
||||||
|
closed and {{.OpenMS}}
|
||||||
|
{{if eq 1 .OpenMS}} milestone {{else}} milestones {{end}}
|
||||||
|
open across {{.RepoCount}}
|
||||||
|
{{if eq 1 .RepoCount}} repository. {{else}} repositories. {{end}}
|
||||||
|
</p>
|
||||||
<div class="github-board">
|
<div class="github-board">
|
||||||
<table class="milestone-table" style="width: 100%;">
|
<table class="milestone-table" style="width: 100%;">
|
||||||
<tbody class="github">
|
<tbody class="github">
|
||||||
{{range $data := .Milestones}}
|
{{range $data := .Milestones}}
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 5%;">
|
<td style="width: 5%;">
|
||||||
{{if $data.IsOpen}}
|
{{if $data.IsMilestone}}
|
||||||
` + openMSsvg + `
|
{{if $data.IsOpen}}
|
||||||
{{else}}
|
` + openMSsvg + `
|
||||||
` + closedMSsvg + `
|
{{else}}
|
||||||
|
` + closedMSsvg + `
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 35%;">
|
<td style="width: 35%;">
|
||||||
|
|
|
@ -24,6 +24,7 @@ import (
|
||||||
type githubRender struct {
|
type githubRender struct {
|
||||||
Config githubConfig `json:"config"`
|
Config githubConfig `json:"config"`
|
||||||
List []githubBranch `json:"list"`
|
List []githubBranch `json:"list"`
|
||||||
|
RepoCount int `json:"repoCount"`
|
||||||
ShowList bool `json:"showList"`
|
ShowList bool `json:"showList"`
|
||||||
ShowIssueNumbers bool `json:"showIssueNumbers"`
|
ShowIssueNumbers bool `json:"showIssueNumbers"`
|
||||||
BranchCommits []githubCommit `json:"branchCommits"`
|
BranchCommits []githubCommit `json:"branchCommits"`
|
||||||
|
|
|
@ -27,7 +27,12 @@ const summaryTemplate = `
|
||||||
|
|
||||||
{{if .HasSharedLabels}}
|
{{if .HasSharedLabels}}
|
||||||
<h3>Common Labels</h3>
|
<h3>Common Labels</h3>
|
||||||
<p>There is 1 shared label across the repositories.</p>
|
<p>There
|
||||||
|
{{if eq 1 (len .SharedLabels)}} is {{else}} are {{end}}
|
||||||
|
{{len .SharedLabels}}
|
||||||
|
shared
|
||||||
|
{{if eq 1 (len .SharedLabels)}} label {{else}} labels {{end}}
|
||||||
|
across the repositories.</p>
|
||||||
<table style="width:100%;">
|
<table style="width:100%;">
|
||||||
<tbody class="github">
|
<tbody class="github">
|
||||||
{{range $slabel := .SharedLabels}}
|
{{range $slabel := .SharedLabels}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue