summaryrefslogtreecommitdiffstats
path: root/models/issue.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-11-21 14:02:37 -0500
committerUnknwon <u@gogs.io>2015-11-21 14:02:37 -0500
commitb4877b1e067f7d6e0a08ff6c79bfc096d32c1331 (patch)
tree8edc539576b32de7044512269ac0073e0054c98e /models/issue.go
parenteea2e05da65c66d9739cecbad77741a0b7c320b0 (diff)
downloadgitea-b4877b1e067f7d6e0a08ff6c79bfc096d32c1331.tar.gz
gitea-b4877b1e067f7d6e0a08ff6c79bfc096d32c1331.zip
fix for #2012
Diffstat (limited to 'models/issue.go')
-rw-r--r--models/issue.go18
1 files changed, 7 insertions, 11 deletions
diff --git a/models/issue.go b/models/issue.go
index 9329f9b568..cee8c36aa1 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -718,32 +718,28 @@ func GetIssueStats(opts *IssueStatsOptions) *IssueStats {
if opts.AssigneeID > 0 {
baseCond += " AND assignee_id=" + com.ToStr(opts.AssigneeID)
}
- if opts.IsPull {
- baseCond += " AND issue.is_pull=1"
- } else {
- baseCond += " AND issue.is_pull=0"
- }
+ baseCond += " AND issue.is_pull=?"
switch opts.FilterMode {
case FM_ALL, FM_ASSIGN:
- results, _ := x.Query(queryStr+baseCond, false)
+ results, _ := x.Query(queryStr+baseCond, false, opts.IsPull)
stats.OpenCount = parseCountResult(results)
- results, _ = x.Query(queryStr+baseCond, true)
+ results, _ = x.Query(queryStr+baseCond, true, opts.IsPull)
stats.ClosedCount = parseCountResult(results)
case FM_CREATE:
baseCond += " AND poster_id=?"
- results, _ := x.Query(queryStr+baseCond, false, opts.UserID)
+ results, _ := x.Query(queryStr+baseCond, false, opts.IsPull, opts.UserID)
stats.OpenCount = parseCountResult(results)
- results, _ = x.Query(queryStr+baseCond, true, opts.UserID)
+ results, _ = x.Query(queryStr+baseCond, true, opts.IsPull, opts.UserID)
stats.ClosedCount = parseCountResult(results)
case FM_MENTION:
queryStr += " INNER JOIN `issue_user` ON `issue`.id=`issue_user`.issue_id"
baseCond += " AND `issue_user`.uid=? AND `issue_user`.is_mentioned=?"
- results, _ := x.Query(queryStr+baseCond, false, opts.UserID, true)
+ results, _ := x.Query(queryStr+baseCond, false, opts.IsPull, opts.UserID, true)
stats.OpenCount = parseCountResult(results)
- results, _ = x.Query(queryStr+baseCond, true, opts.UserID, true)
+ results, _ = x.Query(queryStr+baseCond, true, opts.IsPull, opts.UserID, true)
stats.ClosedCount = parseCountResult(results)
}
return stats