Fix (open/closed) issue count when label excluded (#8815)

* Fix (open/closed) issue count when label excluded

* Use capital sql keywords
release/v1.15
jaqra 2019-11-05 09:48:51 +03:00 committed by techknowlogick
parent a91679c9e3
commit c0f4675a68
1 changed files with 6 additions and 2 deletions

View File

@ -1293,8 +1293,12 @@ func GetIssueStats(opts *IssueStatsOptions) (*IssueStats, error) {
log.Warn("Malformed Labels argument: %s", opts.Labels) log.Warn("Malformed Labels argument: %s", opts.Labels)
} else { } else {
for i, labelID := range labelIDs { for i, labelID := range labelIDs {
if labelID > 0 {
sess.Join("INNER", fmt.Sprintf("issue_label il%d", i), 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)) 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)
}
} }
} }
} }