csgoh / roadmapper

Roadmapper - A Roadmap as Code (Rac) python library. Generate professional roadmap diagram using python code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing End Argument

micmel5997 opened this issue · comments

Can't create a mixed timeline roadmap without an end argument.

commented

Can you elaborate your issue further? What are you trying to achieve?

I am trying to create a mixed timeline, meaning, first few years using quarterly timeline, then biyearly, then yearly. Example function below:

def create_mixed_timeline(roadmap, start_date, end_date):
curr_date = datetime.strptime(start_date, '%Y-%m-%d')
end_date = datetime.strptime(end_date, '%Y-%m-%d')

while curr_date <= end_date:
    if curr_date.year < 2025:  # First 2 years - Quarterly
        roadmap.set_timeline(TimelineMode.QUARTERLY, start=curr_date.strftime('%Y-%m-%d'), end=(curr_date + timedelta(days=90)).strftime('%Y-%m-%d'))
        curr_date += timedelta(days=90)
    elif curr_date.year < 2028:  # Years 3-5 - Half-Yearly
        roadmap.set_timeline(TimelineMode.HALF_YEARLY, start=curr_date.strftime('%Y-%m-%d'), end=(curr_date + timedelta(days=182)).strftime('%Y-%m-%d'))
        curr_date += timedelta(days=182)
    else:  # Years 6-10 - Yearly
        roadmap.set_timeline(TimelineMode.YEARLY, start=curr_date.strftime('%Y-%m-%d'), end=(curr_date + timedelta(days=365)).strftime('%Y-%m-%d'))
        curr_date += timedelta(days=365)