summaryrefslogtreecommitdiffstats
path: root/models/issue.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/issue.go')
-rw-r--r--models/issue.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/models/issue.go b/models/issue.go
index bde5758b02..7561083e0f 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -1849,3 +1849,22 @@ func (issue *Issue) BlockedByDependencies() ([]*Issue, error) {
func (issue *Issue) BlockingDependencies() ([]*Issue, error) {
return issue.getBlockingDependencies(x)
}
+
+func (issue *Issue) updateClosedNum(e Engine) (err error) {
+ if issue.IsPull {
+ _, err = e.Exec("UPDATE `repository` SET num_closed_pulls=(SELECT count(*) FROM issue WHERE repo_id=? AND is_pull=? AND is_closed=?) WHERE id=?",
+ issue.RepoID,
+ true,
+ true,
+ issue.RepoID,
+ )
+ } else {
+ _, err = e.Exec("UPDATE `repository` SET num_closed_issues=(SELECT count(*) FROM issue WHERE repo_id=? AND is_pull=? AND is_closed=?) WHERE id=?",
+ issue.RepoID,
+ false,
+ true,
+ issue.RepoID,
+ )
+ }
+ return
+}