Skip to content

Commit 16103bb

Browse files
committed
Improve codes
1 parent 82ec230 commit 16103bb

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

models/issue.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -1510,14 +1510,10 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
15101510
func CountIssues(opts *IssuesOptions) (int64, error) {
15111511
e := db.GetEngine(db.DefaultContext)
15121512

1513-
var cnt int64
15141513
sess := e.Select("COUNT(issue.id) AS count").Table("issue")
15151514
sess.Join("INNER", "repository", "`issue`.repo_id = `repository`.id")
15161515
opts.setupSessionNoLimit(sess)
1517-
if _, err := sess.Get(&cnt); err != nil {
1518-
return 0, fmt.Errorf("unable to CountIssues: %w", err)
1519-
}
1520-
return cnt, nil
1516+
return sess.Count()
15211517
}
15221518

15231519
// GetParticipantsIDsByIssueID returns the IDs of all users who participated in comments of an issue,

0 commit comments

Comments
 (0)