Skip to content

Commit

Permalink
Fix incorrect milestone count when provide a keyword (go-gitea#25880) (
Browse files Browse the repository at this point in the history
  • Loading branch information
GiteaBot and yp05327 committed Jul 17, 2023
1 parent e627f16 commit 36b9a86
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions routers/web/repo/milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,8 @@ func Milestones(ctx *context.Context) {
ctx.Data["PageIsMilestones"] = true

isShowClosed := ctx.FormString("state") == "closed"
stats, err := issues_model.GetMilestonesStatsByRepoCond(builder.And(builder.Eq{"id": ctx.Repo.Repository.ID}))
if err != nil {
ctx.ServerError("MilestoneStats", err)
return
}
ctx.Data["OpenCount"] = stats.OpenCount
ctx.Data["ClosedCount"] = stats.ClosedCount

sortType := ctx.FormString("sort")

keyword := ctx.FormTrim("q")

page := ctx.FormInt("page")
if page <= 1 {
page = 1
Expand All @@ -74,6 +64,15 @@ func Milestones(ctx *context.Context) {
ctx.ServerError("GetMilestones", err)
return
}

stats, err := issues_model.GetMilestonesStatsByRepoCondAndKw(builder.And(builder.Eq{"id": ctx.Repo.Repository.ID}), keyword)
if err != nil {
ctx.ServerError("GetMilestoneStats", err)
return
}
ctx.Data["OpenCount"] = stats.OpenCount
ctx.Data["ClosedCount"] = stats.ClosedCount

if ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
if err := miles.LoadTotalTrackedTimes(); err != nil {
ctx.ServerError("LoadTotalTrackedTimes", err)
Expand Down

0 comments on commit 36b9a86

Please sign in to comment.