Skip to content

Commit

Permalink
milestone: only show issue-related count under issue list (gogs#4316)
Browse files Browse the repository at this point in the history
  • Loading branch information
unknwon committed Mar 24, 2017
1 parent c441f80 commit 79ba031
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_style = tab
indent_size = 4
2 changes: 1 addition & 1 deletion gogs.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)

const APP_VER = "0.10.28.0323"
const APP_VER = "0.10.29.0324"

func init() {
setting.AppVer = APP_VER
Expand Down
9 changes: 9 additions & 0 deletions models/milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ func (m *Milestone) APIFormat() *api.Milestone {
return apiMilestone
}

func (m *Milestone) CountIssues(isClosed, includePulls bool) int64 {
sess := x.Where("milestone_id = ?", m.ID).And("is_closed = ?", isClosed)
if !includePulls {
sess.And("is_pull = ?", false)
}
count, _ := sess.Count(new(Issue))
return count
}

// NewMilestone creates new milestone of repository.
func NewMilestone(m *Milestone) (err error) {
sess := x.NewSession()
Expand Down
2 changes: 1 addition & 1 deletion routers/repo/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func serviceRPC(h serviceHandler, service string) {
err error
)

// Handle GZIP.
// Handle GZIP
if h.r.Header.Get("Content-Encoding") == "gzip" {
reqBody, err = gzip.NewReader(reqBody)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion templates/.VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.10.28.0323
0.10.29.0324
6 changes: 4 additions & 2 deletions templates/repo/issue/milestones.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@
{{end}}
{{end}}
<span class="issue-stats">
<i class="octicon octicon-issue-opened"></i> {{$.i18n.Tr "repo.issues.open_tab" .NumOpenIssues}}
<i class="octicon octicon-issue-closed"></i> {{$.i18n.Tr "repo.issues.close_tab" .NumClosedIssues}}
{{ $openCount := .CountIssues false false}}
{{ $closedCount := .CountIssues true false}}
<i class="octicon octicon-issue-opened"></i> {{$.i18n.Tr "repo.issues.open_tab" $openCount}}
<i class="octicon octicon-issue-closed"></i> {{$.i18n.Tr "repo.issues.close_tab" $closedCount}}
</span>
</div>
{{if $.IsRepositoryWriter}}
Expand Down

0 comments on commit 79ba031

Please sign in to comment.