-
Notifications
You must be signed in to change notification settings - Fork 33
update: allow up to 10 daysWorked #434
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
Merged
maxceem
merged 3 commits into
topcoder-platform:dev
from
eisbilir:update/10-working-days
Jul 31, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -273,9 +273,11 @@ async function updateWorkPeriod (currentUser, id, data) { | |
if (_.isNil(thisWeek)) { | ||
throw new errors.ConflictError('Work Period dates are not compatible with Resource Booking dates') | ||
} | ||
/* https://github.com/topcoder-platform/taas-apis/issues/428 | ||
if (thisWeek.daysWorked < data.daysWorked) { | ||
throw new errors.BadRequestError(`Maximum allowed daysWorked is (${thisWeek.daysWorked})`) | ||
} | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As we allow up to |
||
data.paymentStatus = helper.calculateWorkPeriodPaymentStatus(_.assign({}, oldValue, data)) | ||
data.updatedBy = await helper.getUserId(currentUser.userId) | ||
const updated = await workPeriod.update(data) | ||
|
@@ -300,7 +302,7 @@ partiallyUpdateWorkPeriod.schema = Joi.object().keys({ | |
currentUser: Joi.object().required(), | ||
id: Joi.string().uuid().required(), | ||
data: Joi.object().keys({ | ||
daysWorked: Joi.number().integer().min(0).max(5) | ||
daysWorked: Joi.number().integer().min(0).max(10) | ||
}).required().min(1) | ||
}).required() | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'm not sure why this check is not valid anymore?
It looks like if we allow maximum 10 working days, we still should not allow this value to be less than
daysPaid
.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.
this checks if
daysPaid
exceeds maximum possibledaysWorked
.maximum possible
daysWorked
is calculated regarding the startDay and endDate.this check won't let us update any RB which has a WP has more paid daysWorked than expected (1-5).
So I moved the part of the logic we need to eventHandler, I don't allow to lower
daysWorked
less thendaysPaid
regardless of dates here:https://github.com/eisbilir/taas-apis/blob/cb194d63722be0d8b6e1b040172c3236cfeadcd0/src/eventHandlers/ResourceBookingEventHandler.js#L192
https://github.com/eisbilir/taas-apis/blob/cb194d63722be0d8b6e1b040172c3236cfeadcd0/src/eventHandlers/ResourceBookingEventHandler.js#L197
https://github.com/eisbilir/taas-apis/blob/cb194d63722be0d8b6e1b040172c3236cfeadcd0/src/eventHandlers/ResourceBookingEventHandler.js#L207
https://github.com/eisbilir/taas-apis/blob/cb194d63722be0d8b6e1b040172c3236cfeadcd0/src/eventHandlers/ResourceBookingEventHandler.js#L212
Example 1
WP-1 has 4 daysWorked as maximum.
daysWorked was increased to 7.
payment was processed and daysPaid increased to 2.
RB dates updated and it forced WP-1 to have 3 daysWorked.
I will allow both RB dates and WP-1 daysWorked (3) to be updated.
Example 2
WP-1 has 4 daysWorked as maximum.
daysWorked was increased to 7.
payment was processed and daysPaid increased to 6.
RB dates updated and it forced WP-1 to have 3 daysWorked.
I will allow RB dates to be updated but WP-1 will keep it daysWorked at 7, same as before update.
WP-1 refers to 1st week.
we use recalculating of daysWorked logic for only the first and the last WP.
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, got it.