aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
author6543 <m.huber@kithara.com>2023-10-19 16:08:31 +0200
committerGitHub <noreply@github.com>2023-10-19 14:08:31 +0000
commitadbc995c347e158a56264f2488997d7d59a4dd8b (patch)
treed571ede3f565910d8890c96932518e7793728647 /routers
parente83f2cbbacd2696f26dde7105d7f07833c0cc33e (diff)
downloadgitea-adbc995c347e158a56264f2488997d7d59a4dd8b.tar.gz
gitea-adbc995c347e158a56264f2488997d7d59a4dd8b.zip
Show total TrackedTime on issue/pull/milestone lists (#26672)
TODOs: - [x] write test for `GetIssueTotalTrackedTime` - [x] frontport kitharas template changes and make them mobile-friendly --- ![image](https://github.com/go-gitea/gitea/assets/24977596/6713da97-201f-4217-8588-4c4cec157171) ![image](https://github.com/go-gitea/gitea/assets/24977596/3a45aba8-26b5-4e6a-b97d-68bfc2bf9024) --- *Sponsored by Kithara Software GmbH*
Diffstat (limited to 'routers')
-rw-r--r--routers/web/repo/issue.go78
1 files changed, 42 insertions, 36 deletions
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 3fd25f81fb..96fce48878 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -198,46 +198,43 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
}
var issueStats *issues_model.IssueStats
- {
- statsOpts := &issues_model.IssuesOptions{
- RepoIDs: []int64{repo.ID},
- LabelIDs: labelIDs,
- MilestoneIDs: mileIDs,
- ProjectID: projectID,
- AssigneeID: assigneeID,
- MentionedID: mentionedID,
- PosterID: posterID,
- ReviewRequestedID: reviewRequestedID,
- ReviewedID: reviewedID,
- IsPull: isPullOption,
- IssueIDs: nil,
- }
- if keyword != "" {
- allIssueIDs, err := issueIDsFromSearch(ctx, keyword, statsOpts)
- if err != nil {
- if issue_indexer.IsAvailable(ctx) {
- ctx.ServerError("issueIDsFromSearch", err)
- return
- }
- ctx.Data["IssueIndexerUnavailable"] = true
+ statsOpts := &issues_model.IssuesOptions{
+ RepoIDs: []int64{repo.ID},
+ LabelIDs: labelIDs,
+ MilestoneIDs: mileIDs,
+ ProjectID: projectID,
+ AssigneeID: assigneeID,
+ MentionedID: mentionedID,
+ PosterID: posterID,
+ ReviewRequestedID: reviewRequestedID,
+ ReviewedID: reviewedID,
+ IsPull: isPullOption,
+ IssueIDs: nil,
+ }
+ if keyword != "" {
+ allIssueIDs, err := issueIDsFromSearch(ctx, keyword, statsOpts)
+ if err != nil {
+ if issue_indexer.IsAvailable(ctx) {
+ ctx.ServerError("issueIDsFromSearch", err)
return
}
- statsOpts.IssueIDs = allIssueIDs
+ ctx.Data["IssueIndexerUnavailable"] = true
+ return
}
- if keyword != "" && len(statsOpts.IssueIDs) == 0 {
- // So it did search with the keyword, but no issue found.
- // Just set issueStats to empty.
- issueStats = &issues_model.IssueStats{}
- } else {
- // So it did search with the keyword, and found some issues. It needs to get issueStats of these issues.
- // Or the keyword is empty, so it doesn't need issueIDs as filter, just get issueStats with statsOpts.
- issueStats, err = issues_model.GetIssueStats(ctx, statsOpts)
- if err != nil {
- ctx.ServerError("GetIssueStats", err)
- return
- }
+ statsOpts.IssueIDs = allIssueIDs
+ }
+ if keyword != "" && len(statsOpts.IssueIDs) == 0 {
+ // So it did search with the keyword, but no issue found.
+ // Just set issueStats to empty.
+ issueStats = &issues_model.IssueStats{}
+ } else {
+ // So it did search with the keyword, and found some issues. It needs to get issueStats of these issues.
+ // Or the keyword is empty, so it doesn't need issueIDs as filter, just get issueStats with statsOpts.
+ issueStats, err = issues_model.GetIssueStats(ctx, statsOpts)
+ if err != nil {
+ ctx.ServerError("GetIssueStats", err)
+ return
}
-
}
isShowClosed := ctx.FormString("state") == "closed"
@@ -246,6 +243,15 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
isShowClosed = true
}
+ if repo.IsTimetrackerEnabled(ctx) {
+ totalTrackedTime, err := issues_model.GetIssueTotalTrackedTime(ctx, statsOpts, isShowClosed)
+ if err != nil {
+ ctx.ServerError("GetIssueTotalTrackedTime", err)
+ return
+ }
+ ctx.Data["TotalTrackedTime"] = totalTrackedTime
+ }
+
archived := ctx.FormBool("archived")
page := ctx.FormInt("page")