mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-15 02:45:22 +00:00
Backport #25880 by @yp05327
You can confirm this issue in:
https://try.gitea.io/yp05327/testrepo/milestones?state=open&q=a
There's no milestone, but the count is 1.
![image](https://github.com/go-gitea/gitea/assets/18380374/25e58cee-aeeb-43c1-8ec8-6e2ec6bf1284)
Co-authored-by: yp05327 <576951401@qq.com>
(cherry picked from commit 36b9a86bd8
)
This commit is contained in:
parent
2de8602855
commit
61c6814c15
|
@ -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
|
||||
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue