diff options
author | Raphael Randschau <nicolai86@me.com> | 2015-02-23 20:32:44 +0100 |
---|---|---|
committer | Raphael Randschau <nicolai86@me.com> | 2015-02-23 21:26:24 +0100 |
commit | 1f61340fa3b255661e3b19432ab0af5162642139 (patch) | |
tree | 6f8efa5381cef3652044f19522f0d441a5afea5b /models/action.go | |
parent | cd8b43d9844cb0de3ef7887178140f1dc43ec72c (diff) | |
download | gitea-1f61340fa3b255661e3b19432ab0af5162642139.tar.gz gitea-1f61340fa3b255661e3b19432ab0af5162642139.zip |
Properly calculate the number of open issues per label
Diffstat (limited to 'models/action.go')
-rw-r--r-- | models/action.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/models/action.go b/models/action.go index 5cba2f515a..a1a33f83a0 100644 --- a/models/action.go +++ b/models/action.go @@ -182,6 +182,17 @@ func updateIssuesCommit(userId, repoId int64, repoUserName, repoName string, com } issue.IsClosed = true + if err = issue.GetLabels(); err != nil { + return err + } + for _, label := range issue.Labels { + label.NumClosedIssues++ + + if err = UpdateLabel(label); err != nil { + return err + } + } + if err = UpdateIssue(issue); err != nil { return err } else if err = UpdateIssueUserPairsByStatus(issue.Id, issue.IsClosed); err != nil { @@ -230,6 +241,17 @@ func updateIssuesCommit(userId, repoId int64, repoUserName, repoName string, com } issue.IsClosed = false + if err = issue.GetLabels(); err != nil { + return err + } + for _, label := range issue.Labels { + label.NumClosedIssues-- + + if err = UpdateLabel(label); err != nil { + return err + } + } + if err = UpdateIssue(issue); err != nil { return err } else if err = UpdateIssueUserPairsByStatus(issue.Id, issue.IsClosed); err != nil { |