Skip to content

Commit

Permalink
Fix (open/closed) issue count when label excluded (#8815)
Browse files Browse the repository at this point in the history
* Fix (open/closed) issue count when label excluded

* Use capital sql keywords
  • Loading branch information
jaqra authored and techknowlogick committed Nov 5, 2019
1 parent a91679c commit c0f4675
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
}
Expand Down

0 comments on commit c0f4675

Please sign in to comment.