from dateutil.relativedelta import relativedelta
def get_svg_timeline(previous_period,current_period,future_period):
svg_content = '"
return svg_content
def get_global_svg_timeline(previous_period,current_period,future_period):
svg_content = ''
svg_previous_period = ""
svg_current_period = ""
svg_future_period = ""
if previous_period is not None:
previous_period_svg = f'\
\
Exploitation'
#{previous_period.start_date.strftime("%d/%m/%Y")}\
#{previous_period.end_date.strftime("%d/%m/%Y")}\
svg_content+=f'Previous (P{current_period.id})' + previous_period_svg
if current_period is not None:
current_period_svg = f'\
\
\
Exploitation'
#{current_period.start_date.strftime("%d/%m/%Y")}\
#{current_period.end_date.strftime("%d/%m/%Y")}\
svg_content+=f'Current (P{current_period.id})' + current_period_svg
if future_period is not None:
future_period_svg = f'\
\
Exploitation'
#{future_period.start_date.strftime("%d/%m/%Y")}\
#{future_period.end_date.strftime("%d/%m/%Y")}\
svg_content+=f'Future (P{future_period.id})' + future_period_svg
return svg_content
def get_proposal_svg_timeline(period,period_name):
proposal_svg = f' \
{period.submission_start_date.strftime("%d/%m/%Y")}\
Proposal submission'
proposal_svg += f'\
{period.submission_end_date.strftime("%d/%m/%Y")}\
Evaluation'
proposal_svg += f'\
{period.unit_pi_validation_start_date.strftime("%d/%m/%Y")}\
Validation'
if period_name == "current":
x2 = "25%"
else:
x2 = "45%"
information_start_date = period.start_date + relativedelta(days=-10)
proposal_svg += f'\
\
\
{information_start_date.strftime("%d/%m/%Y")}\
{period.start_date.strftime("%d/%m/%Y")}\
Notification'
proposal_svg +=f'Period (P{period.id})'
proposal_svg += ""
return proposal_svg