reciprocity/ggrc-core — pull request #2117 by reciprocitylaran (2014-12-24 01:47:13+00:00)
Title: Simpler workflow/cycle date API

This will replace the date logic from ggrc_workflows/__init__.py and RelativeTimeboxed.

The logic currently in __init__.py and RelativeTimeboxed is impossible to get correct for all cases because it recalculates the basedate under various circumstances. Also, it doesn't consistently calculate dates based on their relative values. In some places it uses the first day of the year/quarter/month/week. In other places, in order to get the correct dates the dates need to be calculated relatively.

The login in the WorkflowDateCalculator consistently applies the date calculations with respect to the relative dates based on the task group tasks in the workflow.

Intended use is like this. All known use-cases can be calculated based on these fundamental methods:

- calc start date from basedate
- calc end date from start date
- calculate previous/next cycle start dates from start date
- calculate end date of previous/next cycle from previous/next start date
- adjust start/end dates on a case by case basis in order to get a weekday/non-holiday

Questions welcome. Next step is to swap out the uses of the older methods with the methods in workflow_date_calculator.