-
Notifications
You must be signed in to change notification settings - Fork 56
Issue #127 #144
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
Issue #127 #144
Conversation
…tes of subsequent milestones. - Fixed bug where the transaction wasn't being included into wrapped queries.
@architectt1 I think we don't need to include transaction explicitly. It is automatically handled by continuation-local-storage. |
@vikasrohit it seems that if we move away from |
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 @architectt1 for the investigation and knowledge about async/await
.
src/routes/milestones/update.js
Outdated
}) | ||
.then(() => { | ||
// Update dates of the other milestones only if the completionDate nor the duration changed | ||
if (((!original.completionDate && !updated.completionDate) || |
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.
@architectt1 would it be more readable and manageable to check if milestone's completion date or duration has changed instead of check there is no change in them.
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.
Yes this was an attempt of applying the avoid else, return early
principle, but since there's a single line next, I'm going to apply the change you recommend.
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.
Done in 61cdff3.
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.
And made it more readable as well :)
src/routes/milestones/update.spec.js
Outdated
// endDate: null to '2018-05-21T00:00:00.000Z' | ||
// Milestone 4: startDate: '2018-05-14T00:00:00.000Z' to '2018-05-22T00:00:00.000Z' | ||
// endDate: null to '2018-05-24T00:00:00.000Z' | ||
setTimeout(() => { |
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 don't think we need timeout call here as it was needed only when there was a bug in the way we were handling the transactions i.e. HTTP response was being sent before transaction commit. I fixed those issues with feature/timeline-milestone
branch.
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.
Done in 737c0e6.
src/routes/milestones/update.spec.js
Outdated
// endDate: null to '2018-05-21T00:00:00.000Z' | ||
// Milestone 4: startDate: '2018-05-14T00:00:00.000Z' to '2018-05-22T00:00:00.000Z' | ||
// endDate: null to '2018-05-24T00:00:00.000Z' | ||
setTimeout(() => { |
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.
Same here about need of timeout
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.
Done in 737c0e6.
src/routes/milestones/update.spec.js
Outdated
@@ -482,28 +480,10 @@ describe('UPDATE Milestone', () => { | |||
.expect(422, done); | |||
}); | |||
|
|||
it('should return 422 if startDate is after completionDate', (done) => { | |||
it('should return 422 if startDate is different than the original startDate', (done) => { |
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.
Assuming changes for #148 in the same PR, I think now it makes more sense to just not accept the startDate
and endDate
in payload instead of validating only for different value in these fields.
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.
Done in 737c0e6.
- startDate and endDate are now forbidden from being present in the payload. - Removed explicit check against startDate and endDate parameters, since now they are forbidden.
- Handled scenario where the milestone's endDate was null and the startDate didn't change. Now the endDate gets updated. - When the last timeline's (ordered by order) endDate changes, the timeline gets set that endDate as its endDate. Added unit tests about this. - Updated Swagger documentation. - Removed startDate/endDate fields from Postman's milestone's PATCH requests, since now they are not accepted by the server.
Thanks @architectt1 .
I guess you mean removing async/await and using promises instead, right? |
@vikasrohit no problem. Regarding your question, I forgot to remove that from the description, that was from before when I thought that was needed. I just removed that. |
Uh oh!
There was an error while loading. Please reload this page.