File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -1510,20 +1510,14 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
1510
1510
func CountIssues (opts * IssuesOptions ) (int64 , error ) {
1511
1511
e := db .GetEngine (db .DefaultContext )
1512
1512
1513
- countsSlice := make ([]* struct {
1514
- Count int64
1515
- }, 0 , 1 )
1516
-
1513
+ var cnt int64
1517
1514
sess := e .Select ("COUNT(issue.id) AS count" ).Table ("issue" )
1518
1515
sess .Join ("INNER" , "repository" , "`issue`.repo_id = `repository`.id" )
1519
1516
opts .setupSessionNoLimit (sess )
1520
- if err := sess .Find ( & countsSlice ); err != nil {
1517
+ if _ , err := sess .Get ( & cnt ); err != nil {
1521
1518
return 0 , fmt .Errorf ("unable to CountIssues: %w" , err )
1522
1519
}
1523
- if len (countsSlice ) != 1 {
1524
- return 0 , fmt .Errorf ("unable to get one row result when CountIssues, row count=%d" , len (countsSlice ))
1525
- }
1526
- return countsSlice [0 ].Count , nil
1520
+ return cnt , nil
1527
1521
}
1528
1522
1529
1523
// GetParticipantsIDsByIssueID returns the IDs of all users who participated in comments of an issue,
You can’t perform that action at this time.
0 commit comments