@ -1527,12 +1527,12 @@ func GetIssueStats(opts *IssueStatsOptions) (*IssueStats, error) {
func getIssueStatsChunk ( opts * IssueStatsOptions , issueIDs [ ] int64 ) ( * IssueStats , error ) {
func getIssueStatsChunk ( opts * IssueStatsOptions , issueIDs [ ] int64 ) ( * IssueStats , error ) {
stats := & IssueStats { }
stats := & IssueStats { }
countSession := func ( opts * IssueStatsOptions ) * xorm . Session {
countSession := func ( opts * IssueStatsOptions , issueIDs [ ] int64 ) * xorm . Session {
sess := db . GetEngine ( db . DefaultContext ) .
sess := db . GetEngine ( db . DefaultContext ) .
Where ( "issue.repo_id = ?" , opts . RepoID )
Where ( "issue.repo_id = ?" , opts . RepoID )
if len ( opts . I ssueIDs) > 0 {
if len ( i ssueIDs) > 0 {
sess . In ( "issue.id" , opts . I ssueIDs)
sess . In ( "issue.id" , i ssueIDs)
}
}
if len ( opts . Labels ) > 0 && opts . Labels != "0" {
if len ( opts . Labels ) > 0 && opts . Labels != "0" {
@ -1582,13 +1582,13 @@ func getIssueStatsChunk(opts *IssueStatsOptions, issueIDs []int64) (*IssueStats,
}
}
var err error
var err error
stats . OpenCount , err = countSession ( opts ) .
stats . OpenCount , err = countSession ( opts , issueIDs ) .
And ( "issue.is_closed = ?" , false ) .
And ( "issue.is_closed = ?" , false ) .
Count ( new ( Issue ) )
Count ( new ( Issue ) )
if err != nil {
if err != nil {
return stats , err
return stats , err
}
}
stats . ClosedCount , err = countSession ( opts ) .
stats . ClosedCount , err = countSession ( opts , issueIDs ) .
And ( "issue.is_closed = ?" , true ) .
And ( "issue.is_closed = ?" , true ) .
Count ( new ( Issue ) )
Count ( new ( Issue ) )
return stats , err
return stats , err