-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Background
At the moment, when we automatically create and update WorkPeriods for ResourceBookings as per this logic https://github.com/topcoder-platform/taas-apis/wiki/TaaS---Scope,-Status-and-permissions#work-period-wp-automation-and-constraints. We are going to update this logic as per new requirement https://github.com/topcoder-platform/taas-apis/wiki/Work-Periods-(WP)-Automation-and-Constraints below I would describe the reason for this update and solution.
Issue
Topcoder Manager could be interested in manually set the actual daysWorked for WP.
If after this, we update RB start/end dates, the WPs would be re-calculated automatically, and the value which is set by Manager would be lost, as daysWorked would be re-calculated.
Solution
During automatic creation of WPs we should NOT calculate daysWorked they should be left as null. When we show work periods in UI if we see null UI should calculate the default value to show based on RB start/end dates.
- Manager would be able to manually set
daysWorked. If it's set, then the value would be saved to API. - During automatic WP create/update don't set
daysWorked
Implement Constraints / Automatic updates
- If we reduce the duration of Resource Booking by making
startDatelater orendDateearlier, then- if some WorkPeriod has
daysWorkedset (notnull) then we have to make sure that suchdaysWorkedis a possible value. If currently setdaysWorkedis not possible - we have to update it to maximal possible as per new Resource BookingstartDate/endDate. see examples for constraints
- if some WorkPeriod has
- If we extend the duration of Resource Booking by making
startDateearlier orendDatelater, then no problem.- If some WorkPeriod has
daysWorkedset, we don't update it.
- If some WorkPeriod has
- Update existent unit tests and create good unit tests to check all the essential cases in the logic of constraints and automatic updates - this is important
UI Logic
Not in scope of this issue, but to explain how UI would work:
- if UI sees
daysWorked=nullin some Work Period it should calculate the default value to show by itself - if UI see
daysWorked=Nthen is just shows the value - when in UI we would process payments and
daysWorked=nullthen again the payment would be process with the calculated value which is currently visible to the Manager
