aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorRobin Lambertz <robinlambertz+dev@gmail.com>2016-06-26 19:53:30 +0200
committer无闻 <u@gogs.io>2016-06-27 01:53:30 +0800
commitbc00da1721924a642b470a5a1b44672ee9bc5d4c (patch)
treed634f2b122bcaeb8cc1d2aed9ed042803c135674 /models
parent76a0e43e88c4c43e81d8ef883c8a3483df3109a4 (diff)
downloadgitea-bc00da1721924a642b470a5a1b44672ee9bc5d4c.tar.gz
gitea-bc00da1721924a642b470a5a1b44672ee9bc5d4c.zip
Fix negative issue count (#3207)
Diffstat (limited to 'models')
-rw-r--r--models/repo.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/models/repo.go b/models/repo.go
index 6cc16eca15..5d6b66d046 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -1832,14 +1832,14 @@ func CheckRepoStats() {
// ***** START: Repository.NumClosedIssues *****
desc := "repository count 'num_closed_issues'"
- results, err := x.Query("SELECT repo.id FROM `repository` repo WHERE repo.num_closed_issues!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=?)", true)
+ results, err := x.Query("SELECT repo.id FROM `repository` repo WHERE repo.num_closed_issues!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=? AND is_pull=?)", true, false)
if err != nil {
log.Error(4, "Select %s: %v", desc, err)
} else {
for _, result := range results {
id := com.StrTo(result["id"]).MustInt64()
log.Trace("Updating %s: %d", desc, id)
- _, err = x.Exec("UPDATE `repository` SET num_closed_issues=(SELECT COUNT(*) FROM `issue` WHERE repo_id=? AND is_closed=?) WHERE id=?", id, true, id)
+ _, err = x.Exec("UPDATE `repository` SET num_closed_issues=(SELECT COUNT(*) FROM `issue` WHERE repo_id=? AND is_closed=? AND is_pull=?) WHERE id=?", id, true, false, id)
if err != nil {
log.Error(4, "Update %s[%d]: %v", desc, id, err)
}