-
Notifications
You must be signed in to change notification settings - Fork 34
Allow closed milestone to be selected #51
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
Allow closed milestone to be selected #51
Conversation
Currently the generator will fail if the requested milestone is closed. With this change open and closed milestones are queried, sorted by the latest date in descending order to make it likely that recent milestones appear in the first page of results.
Nice to see this PR. I ran into this behavior too. Are there any plans to add this into the 0.0.5? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Scott. I've added a comment, can you please have a look?
@@ -45,7 +45,7 @@ | |||
|
|||
private static final Pattern LINK_PATTERN = Pattern.compile("<(.+)>; rel=\"(.+)\""); | |||
|
|||
private static final String MILESTONES_URI = "/repos/{owner}/{name}/milestones"; | |||
private static final String MILESTONES_URI = "/repos/{owner}/{name}/milestones?state=all&sort=due_on&direction=desc&per_page=50"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit nervous that sort=due_on would show milestones that don't have a due date first as it is the case on the Web UI. For projects with a large number of milestones, this may be a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't appear to be what happens with the REST API. Testing against spring-projects/spring-boot returns 50 milestones all of which have a non-null due_on
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Querying just the open milestones confirms that those with a null
due_on
appear last when using a descending sort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, the descending sort puts the furthest out milestones first, i.e. it's the same as the Web UI's "Furthest due date". If you switch to an ascending sort with open and closed milestones, you get all those with no due date first followed by lots of old milestones..
In short, a descending due_on
sort is correct and it'll be fine as long as you don't have a 50 milestones scheduled after the one for which the change log is being generated.
Currently the generator will fail if the requested milestone is closed.
With this change open and closed milestones are queried, sorted by
the latest date in descending order to make it likely that recent
milestones appear in the first page of results.