summaryrefslogtreecommitdiffstats
path: root/models/issue_milestone_test.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-03-31 15:47:00 +0800
committerGitHub <noreply@github.com>2020-03-31 10:47:00 +0300
commit73cf0e2614263c8c4ad6d55d06e753b28d2b6091 (patch)
treef29c9e8d5381aeeceb4acba1bde5bc9a3a45b29e /models/issue_milestone_test.go
parentbf847b9397b0365a81d1a2ca5386a6c4280d9e94 (diff)
downloadgitea-73cf0e2614263c8c4ad6d55d06e753b28d2b6091.tar.gz
gitea-73cf0e2614263c8c4ad6d55d06e753b28d2b6091.zip
Fix milestones too many SQL variables bug (#10880)
* Fix milestones too many SQL variables bug * Fix test * Don't display repositories with no milestone and fix tests * Remove unused code and add some comments
Diffstat (limited to 'models/issue_milestone_test.go')
-rw-r--r--models/issue_milestone_test.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/models/issue_milestone_test.go b/models/issue_milestone_test.go
index 778ebfbda3..607d36c31c 100644
--- a/models/issue_milestone_test.go
+++ b/models/issue_milestone_test.go
@@ -11,6 +11,7 @@ import (
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
+ "xorm.io/builder"
"github.com/stretchr/testify/assert"
)
@@ -370,7 +371,7 @@ func TestGetMilestonesStats(t *testing.T) {
repo1 := AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository)
repo2 := AssertExistsAndLoadBean(t, &Repository{ID: 2}).(*Repository)
- milestoneStats, err := GetMilestonesStats([]int64{repo1.ID, repo2.ID})
+ milestoneStats, err := GetMilestonesStats(builder.In("repo_id", []int64{repo1.ID, repo2.ID}))
assert.NoError(t, err)
assert.EqualValues(t, repo1.NumOpenMilestones+repo2.NumOpenMilestones, milestoneStats.OpenCount)
assert.EqualValues(t, repo1.NumClosedMilestones+repo2.NumClosedMilestones, milestoneStats.ClosedCount)