mirror of
https://github.com/go-gitea/gitea
synced 2024-11-26 07:12:48 +01:00
fix for #2012
This commit is contained in:
parent
eea2e05da6
commit
b4877b1e06
1 changed files with 7 additions and 11 deletions
|
@ -718,32 +718,28 @@ func GetIssueStats(opts *IssueStatsOptions) *IssueStats {
|
||||||
if opts.AssigneeID > 0 {
|
if opts.AssigneeID > 0 {
|
||||||
baseCond += " AND assignee_id=" + com.ToStr(opts.AssigneeID)
|
baseCond += " AND assignee_id=" + com.ToStr(opts.AssigneeID)
|
||||||
}
|
}
|
||||||
if opts.IsPull {
|
baseCond += " AND issue.is_pull=?"
|
||||||
baseCond += " AND issue.is_pull=1"
|
|
||||||
} else {
|
|
||||||
baseCond += " AND issue.is_pull=0"
|
|
||||||
}
|
|
||||||
|
|
||||||
switch opts.FilterMode {
|
switch opts.FilterMode {
|
||||||
case FM_ALL, FM_ASSIGN:
|
case FM_ALL, FM_ASSIGN:
|
||||||
results, _ := x.Query(queryStr+baseCond, false)
|
results, _ := x.Query(queryStr+baseCond, false, opts.IsPull)
|
||||||
stats.OpenCount = parseCountResult(results)
|
stats.OpenCount = parseCountResult(results)
|
||||||
results, _ = x.Query(queryStr+baseCond, true)
|
results, _ = x.Query(queryStr+baseCond, true, opts.IsPull)
|
||||||
stats.ClosedCount = parseCountResult(results)
|
stats.ClosedCount = parseCountResult(results)
|
||||||
|
|
||||||
case FM_CREATE:
|
case FM_CREATE:
|
||||||
baseCond += " AND poster_id=?"
|
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)
|
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)
|
stats.ClosedCount = parseCountResult(results)
|
||||||
|
|
||||||
case FM_MENTION:
|
case FM_MENTION:
|
||||||
queryStr += " INNER JOIN `issue_user` ON `issue`.id=`issue_user`.issue_id"
|
queryStr += " INNER JOIN `issue_user` ON `issue`.id=`issue_user`.issue_id"
|
||||||
baseCond += " AND `issue_user`.uid=? AND `issue_user`.is_mentioned=?"
|
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)
|
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)
|
stats.ClosedCount = parseCountResult(results)
|
||||||
}
|
}
|
||||||
return stats
|
return stats
|
||||||
|
|
Loading…
Reference in a new issue