@@ -198,46 +198,43 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
198198 }
199199
200200 var issueStats * issues_model.IssueStats
201- {
202- statsOpts := & issues_model.IssuesOptions {
203- RepoIDs : []int64 {repo .ID },
204- LabelIDs : labelIDs ,
205- MilestoneIDs : mileIDs ,
206- ProjectID : projectID ,
207- AssigneeID : assigneeID ,
208- MentionedID : mentionedID ,
209- PosterID : posterID ,
210- ReviewRequestedID : reviewRequestedID ,
211- ReviewedID : reviewedID ,
212- IsPull : isPullOption ,
213- IssueIDs : nil ,
214- }
215- if keyword != "" {
216- allIssueIDs , err := issueIDsFromSearch (ctx , keyword , statsOpts )
217- if err != nil {
218- if issue_indexer .IsAvailable (ctx ) {
219- ctx .ServerError ("issueIDsFromSearch" , err )
220- return
221- }
222- ctx .Data ["IssueIndexerUnavailable" ] = true
201+ statsOpts := & issues_model.IssuesOptions {
202+ RepoIDs : []int64 {repo .ID },
203+ LabelIDs : labelIDs ,
204+ MilestoneIDs : mileIDs ,
205+ ProjectID : projectID ,
206+ AssigneeID : assigneeID ,
207+ MentionedID : mentionedID ,
208+ PosterID : posterID ,
209+ ReviewRequestedID : reviewRequestedID ,
210+ ReviewedID : reviewedID ,
211+ IsPull : isPullOption ,
212+ IssueIDs : nil ,
213+ }
214+ if keyword != "" {
215+ allIssueIDs , err := issueIDsFromSearch (ctx , keyword , statsOpts )
216+ if err != nil {
217+ if issue_indexer .IsAvailable (ctx ) {
218+ ctx .ServerError ("issueIDsFromSearch" , err )
223219 return
224220 }
225- statsOpts .IssueIDs = allIssueIDs
221+ ctx .Data ["IssueIndexerUnavailable" ] = true
222+ return
226223 }
227- if keyword != "" && len (statsOpts .IssueIDs ) == 0 {
228- // So it did search with the keyword, but no issue found.
229- // Just set issueStats to empty.
230- issueStats = & issues_model.IssueStats {}
231- } else {
232- // So it did search with the keyword, and found some issues. It needs to get issueStats of these issues.
233- // Or the keyword is empty, so it doesn't need issueIDs as filter, just get issueStats with statsOpts.
234- issueStats , err = issues_model .GetIssueStats (ctx , statsOpts )
235- if err != nil {
236- ctx .ServerError ("GetIssueStats" , err )
237- return
238- }
224+ statsOpts .IssueIDs = allIssueIDs
225+ }
226+ if keyword != "" && len (statsOpts .IssueIDs ) == 0 {
227+ // So it did search with the keyword, but no issue found.
228+ // Just set issueStats to empty.
229+ issueStats = & issues_model.IssueStats {}
230+ } else {
231+ // So it did search with the keyword, and found some issues. It needs to get issueStats of these issues.
232+ // Or the keyword is empty, so it doesn't need issueIDs as filter, just get issueStats with statsOpts.
233+ issueStats , err = issues_model .GetIssueStats (ctx , statsOpts )
234+ if err != nil {
235+ ctx .ServerError ("GetIssueStats" , err )
236+ return
239237 }
240-
241238 }
242239
243240 isShowClosed := ctx .FormString ("state" ) == "closed"
@@ -246,6 +243,15 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
246243 isShowClosed = true
247244 }
248245
246+ if repo .IsTimetrackerEnabled (ctx ) {
247+ totalTrackedTime , err := issues_model .GetIssueTotalTrackedTime (ctx , statsOpts , isShowClosed )
248+ if err != nil {
249+ ctx .ServerError ("GetIssueTotalTrackedTime" , err )
250+ return
251+ }
252+ ctx .Data ["TotalTrackedTime" ] = totalTrackedTime
253+ }
254+
249255 archived := ctx .FormBool ("archived" )
250256
251257 page := ctx .FormInt ("page" )
0 commit comments