mirror of
https://github.com/documize/community.git
synced 2025-07-21 14:19: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}}
|
||||
|
||||
<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%;">
|
||||
|
||||
<tbody class="github">
|
||||
|
|
|
@ -30,7 +30,10 @@ const (
|
|||
<div class="section-github-render">
|
||||
{{if .HasIssues}}
|
||||
<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>
|
||||
{{if .ShowList}}
|
||||
Including issues labelled
|
||||
|
|
|
@ -174,30 +174,34 @@ func refreshMilestones(gr *githubRender, config *githubConfig, client *gogithub.
|
|||
|
||||
func renderMilestones(payload *githubRender, c *githubConfig) error {
|
||||
hadRepo := make(map[string]bool)
|
||||
payload.RepoCount = 0
|
||||
for _, orb := range payload.List {
|
||||
rName := orb.Owner + "/" + orb.Repo
|
||||
if !hadRepo[rName] {
|
||||
if orb.Included {
|
||||
|
||||
issuesOpen, issuesClosed := 0, 0
|
||||
for _, iss := range payload.Issues {
|
||||
if iss.Repo == repoName(rName) {
|
||||
if iss.Milestone == noMilestone {
|
||||
if iss.IsOpen {
|
||||
issuesOpen++
|
||||
} else {
|
||||
issuesClosed++
|
||||
payload.RepoCount++
|
||||
issuesOpen, issuesClosed := 0, 0
|
||||
for _, iss := range payload.Issues {
|
||||
if iss.Repo == repoName(rName) {
|
||||
if iss.Milestone == noMilestone {
|
||||
if iss.IsOpen {
|
||||
issuesOpen++
|
||||
} else {
|
||||
issuesClosed++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if issuesClosed+issuesOpen > 0 {
|
||||
payload.Milestones = append(payload.Milestones, githubMilestone{
|
||||
Repo: orb.Repo, Private: orb.Private, Name: noMilestone, IsOpen: true,
|
||||
OpenIssues: issuesOpen, ClosedIssues: issuesClosed, URL: orb.URL,
|
||||
})
|
||||
}
|
||||
if issuesClosed+issuesOpen > 0 {
|
||||
payload.Milestones = append(payload.Milestones, githubMilestone{
|
||||
Repo: orb.Repo, Private: orb.Private, Name: noMilestone, IsOpen: true,
|
||||
OpenIssues: issuesOpen, ClosedIssues: issuesClosed, URL: orb.URL,
|
||||
})
|
||||
}
|
||||
|
||||
hadRepo[rName] = true
|
||||
hadRepo[rName] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,17 +32,27 @@ const (
|
|||
|
||||
{{if .HasMilestones}}
|
||||
<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">
|
||||
<table class="milestone-table" style="width: 100%;">
|
||||
<tbody class="github">
|
||||
{{range $data := .Milestones}}
|
||||
<tr>
|
||||
<td style="width: 5%;">
|
||||
{{if $data.IsOpen}}
|
||||
` + openMSsvg + `
|
||||
{{else}}
|
||||
` + closedMSsvg + `
|
||||
{{if $data.IsMilestone}}
|
||||
{{if $data.IsOpen}}
|
||||
` + openMSsvg + `
|
||||
{{else}}
|
||||
` + closedMSsvg + `
|
||||
{{end}}
|
||||
{{end}}
|
||||
</td>
|
||||
<td style="width: 35%;">
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
type githubRender struct {
|
||||
Config githubConfig `json:"config"`
|
||||
List []githubBranch `json:"list"`
|
||||
RepoCount int `json:"repoCount"`
|
||||
ShowList bool `json:"showList"`
|
||||
ShowIssueNumbers bool `json:"showIssueNumbers"`
|
||||
BranchCommits []githubCommit `json:"branchCommits"`
|
||||
|
|
|
@ -27,7 +27,12 @@ const summaryTemplate = `
|
|||
|
||||
{{if .HasSharedLabels}}
|
||||
<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%;">
|
||||
<tbody class="github">
|
||||
{{range $slabel := .SharedLabels}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue