|
|
@ -23,13 +23,7 @@ def reformat_value(source, question_key): |
|
|
except: |
|
|
except: |
|
|
if question_key == 'spouse_support_details' or question_key == 'other_orders_detail'\ |
|
|
if question_key == 'spouse_support_details' or question_key == 'other_orders_detail'\ |
|
|
or question_key == 'provide_certificate_later_reason' or question_key == 'not_provide_certificate_reason': |
|
|
or question_key == 'provide_certificate_later_reason' or question_key == 'not_provide_certificate_reason': |
|
|
text_list = source.split('\n') |
|
|
|
|
|
tag = ["<ul>"] |
|
|
|
|
|
for value in text_list: |
|
|
|
|
|
if value and not value.isspace(): |
|
|
|
|
|
tag.append('<li>' + value + '</li>') |
|
|
|
|
|
tag.append('</ul>') |
|
|
|
|
|
return ''.join(tag) |
|
|
|
|
|
|
|
|
return reformat_list(source) |
|
|
return source |
|
|
return source |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -47,6 +41,19 @@ def process_list(lst, question_key): |
|
|
return ''.join(tag) |
|
|
return ''.join(tag) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def reformat_list(source): |
|
|
|
|
|
text_list = source.split('\n') |
|
|
|
|
|
if len(text_list) > 1: |
|
|
|
|
|
tag = ["<ul>"] |
|
|
|
|
|
for value in text_list: |
|
|
|
|
|
if value and not value.isspace(): |
|
|
|
|
|
tag.append('<li>' + value + '</li>') |
|
|
|
|
|
tag.append('</ul>') |
|
|
|
|
|
return ''.join(tag) |
|
|
|
|
|
else: |
|
|
|
|
|
return text_list.pop() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def format_row(question, response): |
|
|
def format_row(question, response): |
|
|
return '<tr><td width="75%" class="table-bordered" style="padding-right: 5%">{0}</td><td class="table-bordered" width="25%">{1}</td></tr>'.format( |
|
|
return '<tr><td width="75%" class="table-bordered" style="padding-right: 5%">{0}</td><td class="table-bordered" width="25%">{1}</td></tr>'.format( |
|
|
question, response |
|
|
question, response |
|
|
@ -170,12 +177,15 @@ def format_children(context, source): |
|
|
tags.append(format_fact_sheet(question, fact_sheet_mapping[question])) |
|
|
tags.append(format_fact_sheet(question, fact_sheet_mapping[question])) |
|
|
else: |
|
|
else: |
|
|
|
|
|
|
|
|
|
|
|
item = list(filter(lambda x: x['question_id'] == question, working_source)) |
|
|
|
|
|
|
|
|
# skip child support order related questions if user did not select that option |
|
|
# skip child support order related questions if user did not select that option |
|
|
if question in child_support_orders and context['derived']['wants_child_support'] is False: |
|
|
|
|
|
|
|
|
if question in child_support_orders: |
|
|
|
|
|
item = item.pop() |
|
|
|
|
|
if context['derived']['wants_child_support'] is True: |
|
|
|
|
|
tags.append(format_row(item['question__name'], reformat_list(item['value']))) |
|
|
continue |
|
|
continue |
|
|
|
|
|
|
|
|
item = list(filter(lambda x: x['question_id'] == question, working_source)) |
|
|
|
|
|
|
|
|
|
|
|
if len(item): |
|
|
if len(item): |
|
|
item = item.pop() |
|
|
item = item.pop() |
|
|
q_id = item['question_id'] |
|
|
q_id = item['question_id'] |
|
|
|