diff options
author | jaqra <48099350+jaqra@users.noreply.github.com> | 2019-11-05 09:48:51 +0300 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-11-05 01:48:51 -0500 |
commit | c0f4675a68278ce648cdefe73b7b6b65327ed89a (patch) | |
tree | 277a339e6eb1e1bd34e159868fe1ed7d6750af12 /models/issue.go | |
parent | a91679c9e337c46ab3e441097236f7a4dc07938d (diff) | |
download | gitea-c0f4675a68278ce648cdefe73b7b6b65327ed89a.tar.gz gitea-c0f4675a68278ce648cdefe73b7b6b65327ed89a.zip |
Fix (open/closed) issue count when label excluded (#8815)
* Fix (open/closed) issue count when label excluded
* Use capital sql keywords
Diffstat (limited to 'models/issue.go')
-rw-r--r-- | models/issue.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/models/issue.go b/models/issue.go index 78413468b2..1e9d973186 100644 --- a/models/issue.go +++ b/models/issue.go @@ -1293,8 +1293,12 @@ func GetIssueStats(opts *IssueStatsOptions) (*IssueStats, error) { log.Warn("Malformed Labels argument: %s", opts.Labels) } else { for i, labelID := range labelIDs { - sess.Join("INNER", fmt.Sprintf("issue_label il%d", i), - fmt.Sprintf("issue.id = il%[1]d.issue_id AND il%[1]d.label_id = %[2]d", i, labelID)) + if labelID > 0 { + sess.Join("INNER", fmt.Sprintf("issue_label il%d", i), + fmt.Sprintf("issue.id = il%[1]d.issue_id AND il%[1]d.label_id = %[2]d", i, labelID)) + } else { + sess.Where("issue.id NOT IN (SELECT issue_id FROM issue_label WHERE label_id = ?)", -labelID) + } } } } |