fix issue stats with milestone filter
This commit is contained in:
parent
81d01aa308
commit
34795770c3
@ -426,7 +426,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// GetIssueStats returns issue statistic information by given conditions.
|
// GetIssueStats returns issue statistic information by given conditions.
|
||||||
func GetIssueStats(repoID, uid, labelID int64, isShowClosed bool, filterMode int) *IssueStats {
|
func GetIssueStats(repoID, uid, labelID, milestoneID int64, isShowClosed bool, filterMode int) *IssueStats {
|
||||||
stats := &IssueStats{}
|
stats := &IssueStats{}
|
||||||
issue := new(Issue)
|
issue := new(Issue)
|
||||||
|
|
||||||
@ -434,6 +434,9 @@ func GetIssueStats(repoID, uid, labelID int64, isShowClosed bool, filterMode int
|
|||||||
if labelID > 0 {
|
if labelID > 0 {
|
||||||
queryStr += " AND issue.label_ids like '%$" + com.ToStr(labelID) + "|%'"
|
queryStr += " AND issue.label_ids like '%$" + com.ToStr(labelID) + "|%'"
|
||||||
}
|
}
|
||||||
|
if milestoneID > 0 {
|
||||||
|
queryStr += " AND milestone_id=" + com.ToStr(milestoneID)
|
||||||
|
}
|
||||||
switch filterMode {
|
switch filterMode {
|
||||||
case FM_ALL:
|
case FM_ALL:
|
||||||
stats.OpenCount, _ = x.Where(queryStr, repoID, false).Count(issue)
|
stats.OpenCount, _ = x.Where(queryStr, repoID, false).Count(issue)
|
||||||
|
@ -95,7 +95,7 @@ func Issues(ctx *middleware.Context) {
|
|||||||
selectLabels := ctx.Query("labels")
|
selectLabels := ctx.Query("labels")
|
||||||
milestoneID := ctx.QueryInt64("milestone")
|
milestoneID := ctx.QueryInt64("milestone")
|
||||||
isShowClosed := ctx.Query("state") == "closed"
|
isShowClosed := ctx.Query("state") == "closed"
|
||||||
issueStats := models.GetIssueStats(repo.Id, uid, com.StrTo(selectLabels).MustInt64(), isShowClosed, filterMode)
|
issueStats := models.GetIssueStats(repo.Id, uid, com.StrTo(selectLabels).MustInt64(), milestoneID, isShowClosed, filterMode)
|
||||||
|
|
||||||
page := ctx.QueryInt("page")
|
page := ctx.QueryInt("page")
|
||||||
if page <= 1 {
|
if page <= 1 {
|
||||||
|
Loading…
Reference in New Issue
Block a user