From 09cb48e41cae905c5e4db10af1296a1c364d0675 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 24 Mar 2017 18:36:35 -0400 Subject: [PATCH] repo: recalculate milestone completeness on issue list (#4316) --- routers/repo/issue.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routers/repo/issue.go b/routers/repo/issue.go index d2d95bfc1..4ab8bc9bd 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -1087,6 +1087,11 @@ func Milestones(ctx *context.Context) { return } for _, m := range miles { + m.NumOpenIssues = int(m.CountIssues(false, false)) + m.NumClosedIssues = int(m.CountIssues(true, false)) + if m.NumOpenIssues+m.NumClosedIssues > 0 { + m.Completeness = m.NumClosedIssues * 100 / (m.NumOpenIssues + m.NumClosedIssues) + } m.RenderedContent = string(markdown.Render([]byte(m.Content), ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas())) } ctx.Data["Milestones"] = miles