summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-07-25 13:07:00 +0800
committerUnknwon <u@gogs.io>2015-07-25 13:07:00 +0800
commit2e7b38db9f0089b2c0af9ae81a969fe03b799a40 (patch)
tree50afe0b87f8479c771cfb847d76d3e652751a67f /models
parent68cacf9c63024921818190163b3fa25158980b09 (diff)
downloadgitea-2e7b38db9f0089b2c0af9ae81a969fe03b799a40.tar.gz
gitea-2e7b38db9f0089b2c0af9ae81a969fe03b799a40.zip
fix paging links and issue count
Diffstat (limited to 'models')
-rw-r--r--models/issue.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/models/issue.go b/models/issue.go
index 03a8a52ef9..e02659240b 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -412,7 +412,10 @@ func GetIssueStats(repoID, uid, labelID int64, isShowClosed bool, filterMode int
stats := &IssueStats{}
issue := new(Issue)
- queryStr := "repo_id=? AND is_closed=?"
+ queryStr := "issue.repo_id=? AND issue.is_closed=?"
+ if labelID > 0 {
+ queryStr += " AND issue.label_ids like '%$" + com.ToStr(labelID) + "|%'"
+ }
switch filterMode {
case FM_ALL:
stats.OpenCount, _ = x.Where(queryStr, repoID, false).Count(issue)
@@ -433,6 +436,15 @@ func GetIssueStats(repoID, uid, labelID int64, isShowClosed bool, filterMode int
case FM_MENTION:
queryStr += " AND uid=? AND is_mentioned=?"
+ if labelID > 0 {
+ stats.OpenCount, _ = x.Where(queryStr, repoID, false, uid, true).
+ Join("INNER", "issue", "issue.id = issue_id").Count(new(IssueUser))
+ stats.ClosedCount, _ = x.Where(queryStr, repoID, true, uid, true).
+ Join("INNER", "issue", "issue.id = issue_id").Count(new(IssueUser))
+ return stats
+ }
+
+ queryStr = strings.Replace(queryStr, "issue.", "", 2)
stats.OpenCount, _ = x.Where(queryStr, repoID, false, uid, true).Count(new(IssueUser))
stats.ClosedCount, _ = x.Where(queryStr, repoID, true, uid, true).Count(new(IssueUser))
return stats