mirror of
https://github.com/go-gitea/gitea
synced 2024-11-05 13:49:10 +01:00
Fix negative issue count (#3207)
This commit is contained in:
parent
76a0e43e88
commit
bc00da1721
1 changed files with 2 additions and 2 deletions
|
@ -1832,14 +1832,14 @@ func CheckRepoStats() {
|
||||||
|
|
||||||
// ***** START: Repository.NumClosedIssues *****
|
// ***** START: Repository.NumClosedIssues *****
|
||||||
desc := "repository count 'num_closed_issues'"
|
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 {
|
if err != nil {
|
||||||
log.Error(4, "Select %s: %v", desc, err)
|
log.Error(4, "Select %s: %v", desc, err)
|
||||||
} else {
|
} else {
|
||||||
for _, result := range results {
|
for _, result := range results {
|
||||||
id := com.StrTo(result["id"]).MustInt64()
|
id := com.StrTo(result["id"]).MustInt64()
|
||||||
log.Trace("Updating %s: %d", desc, id)
|
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 {
|
if err != nil {
|
||||||
log.Error(4, "Update %s[%d]: %v", desc, id, err)
|
log.Error(4, "Update %s[%d]: %v", desc, id, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue