Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add /milestones endpoint #8733

Merged
merged 46 commits into from
Dec 15, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
227a970
in progress checkpoint
bhalbright Oct 22, 2019
9fe22ba
an initial crack at the milestones showing up; the expected milestone…
bhalbright Oct 23, 2019
614f95e
in progress checkpoint, ui looks better and got the repo name to show…
bhalbright Oct 24, 2019
7dae2df
in-progress work on adding time tracking totals to the milestones on …
bhalbright Oct 26, 2019
6a2136e
adding time tracking totals to milestrones for the dashboard view
bhalbright Oct 26, 2019
f770682
fixed issue with in your repositories total on milestones dashboard
bhalbright Oct 27, 2019
2f6a674
change to use PageIsMilestonesDashboard for the dashboard active item…
bhalbright Oct 27, 2019
961accc
fixed/removed some comments
bhalbright Oct 27, 2019
4a67ddc
Merge branch 'master' of https://github.com/go-gitea/gitea into miles…
bhalbright Oct 27, 2019
b6f5da8
todo comments on integration tests to write
bhalbright Oct 29, 2019
8bbe415
checking error on LoadTotalTrackedTime in home.go
bhalbright Oct 30, 2019
767d2f1
Merge branch 'master' of https://github.com/go-gitea/gitea into miles…
bhalbright Oct 31, 2019
e352efe
added integration test for CountMilestonesByRepo
bhalbright Nov 1, 2019
1a4efb2
Merge branch 'master' of https://github.com/go-gitea/gitea into miles…
bhalbright Nov 1, 2019
ba0f7ff
added test TestGetMilestonesByRepoIDs
bhalbright Nov 2, 2019
9097d45
Merge branch 'master' of https://github.com/go-gitea/gitea into miles…
bhalbright Nov 2, 2019
04628dc
added more milestone tests, removed the YourRepositoryCount property …
bhalbright Nov 2, 2019
afcce09
added test for Milestones endpoint
bhalbright Nov 2, 2019
96d1e11
fixed unit test
bhalbright Nov 2, 2019
70f4614
fixed unit test
bhalbright Nov 3, 2019
92289d2
added unit test for milestones endpoint where a repo is selected
bhalbright Nov 3, 2019
02c2bc4
removed view type param from milestones endpoint because it wasn't be…
bhalbright Nov 23, 2019
ffe6d80
Merge branch 'master' of https://github.com/go-gitea/gitea into miles…
bhalbright Nov 23, 2019
d25e1f3
Merge branch 'master' of https://github.com/go-gitea/gitea into miles…
bhalbright Dec 7, 2019
ce00c53
Merge branch 'master' into milestones
lunny Dec 8, 2019
e1bc0f3
Merge branch 'master' of https://github.com/go-gitea/gitea into miles…
bhalbright Dec 8, 2019
8e731a4
Merge branch 'master' of https://github.com/go-gitea/gitea into miles…
bhalbright Dec 9, 2019
875e512
added configuration to enable/disable the milestones dashboard endpoi…
bhalbright Dec 9, 2019
32bcda0
Merge branch 'master' of https://github.com/go-gitea/gitea into miles…
bhalbright Dec 10, 2019
3a71b07
changed "CountMilestonesByRepo" to "CountMilestonesByRepoIDs" so the …
bhalbright Dec 10, 2019
a178e54
Merge branch 'master' into milestones
lunny Dec 14, 2019
e6cae8a
Merge remote-tracking branch 'user/bhalbright/milestones' into milest…
6543 Dec 14, 2019
489a660
fix-stats-count
6543 Dec 14, 2019
f2bbc6e
fix test
6543 Dec 14, 2019
3220b65
add-integration-tests
6543 Dec 14, 2019
eb674fc
make multi selectable
6543 Dec 14, 2019
612f0ef
Merge branch 'master' of https://github.com/go-gitea/gitea into miles…
bhalbright Dec 14, 2019
ecfa69f
Merge branch 'milestones-multiselectable' of https://github.com/6543-…
bhalbright Dec 14, 2019
aaad768
Update integrations/links_test.go
bhalbright Dec 14, 2019
f264f5d
Update integrations/links_test.go
bhalbright Dec 14, 2019
cd60aa9
Merge branch 'master' into milestones
lunny Dec 15, 2019
dd15e48
Merge branch 'master' into milestones
zeripath Dec 15, 2019
b33d30a
Update integrations/links_test.go
bhalbright Dec 15, 2019
218aa5b
Update integrations/links_test.go
bhalbright Dec 15, 2019
5d161b3
Merge branch 'master' of https://github.com/go-gitea/gitea into miles…
bhalbright Dec 15, 2019
def5416
Merge branch 'master' into milestones
zeripath Dec 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
changed "CountMilestonesByRepo" to "CountMilestonesByRepoIDs" so the …
…naming matches up with the function "GetMilestonesByRepoIDs"
  • Loading branch information
bhalbright committed Dec 10, 2019
commit 3a71b0778670a825c572b55bfa2e57d214fa419b
4 changes: 2 additions & 2 deletions models/issue_milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,8 @@ func DeleteMilestoneByRepoID(repoID, id int64) error {
return sess.Commit()
}

// CountMilestonesByRepo map from repoIDs to number of milestones matching the options`
func CountMilestonesByRepo(repoIDs []int64, isClosed bool) (map[int64]int64, error) {
// CountMilestonesByRepoIDs map from repoIDs to number of milestones matching the options`
func CountMilestonesByRepoIDs(repoIDs []int64, isClosed bool) (map[int64]int64, error) {
sess := x.Where("is_closed = ?", isClosed)
sess.In("repo_id", repoIDs)

Expand Down
6 changes: 3 additions & 3 deletions models/issue_milestone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func TestMilestoneList_LoadTotalTrackedTimes(t *testing.T) {
assert.Equal(t, miles[0].TotalTrackedTime, int64(3662))
}

func TestCountMilestonesByRepo(t *testing.T) {
func TestCountMilestonesByRepoIDs(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
milestonesCount := func(repoID int64) (int, int) {
repo := AssertExistsAndLoadBean(t, &Repository{ID: repoID}).(*Repository)
Expand All @@ -299,12 +299,12 @@ func TestCountMilestonesByRepo(t *testing.T) {
repo1OpenCount, repo1ClosedCount := milestonesCount(1)
repo2OpenCount, repo2ClosedCount := milestonesCount(2)

openCounts, err := CountMilestonesByRepo([]int64{1, 2}, false)
openCounts, err := CountMilestonesByRepoIDs([]int64{1, 2}, false)
assert.NoError(t, err)
assert.EqualValues(t, repo1OpenCount, openCounts[1])
assert.EqualValues(t, repo2OpenCount, openCounts[2])

closedCounts, err := CountMilestonesByRepo([]int64{1, 2}, true)
closedCounts, err := CountMilestonesByRepoIDs([]int64{1, 2}, true)
assert.NoError(t, err)
assert.EqualValues(t, repo1ClosedCount, closedCounts[1])
assert.EqualValues(t, repo2ClosedCount, closedCounts[2])
Expand Down
4 changes: 2 additions & 2 deletions routers/user/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ func Milestones(ctx *context.Context) {
repoIDs = userRepoIDs
}

counts, err := models.CountMilestonesByRepo(repoIDs, isShowClosed)
counts, err := models.CountMilestonesByRepoIDs(repoIDs, isShowClosed)
if err != nil {
ctx.ServerError("CountMilestonesByRepo", err)
ctx.ServerError("CountMilestonesByRepoIDs", err)
return
}

Expand Down