diff --git a/edivorce/apps/core/templatetags/summary_format.py b/edivorce/apps/core/templatetags/summary_format.py
index 526d464f..7652f66a 100644
--- a/edivorce/apps/core/templatetags/summary_format.py
+++ b/edivorce/apps/core/templatetags/summary_format.py
@@ -23,13 +23,7 @@ def reformat_value(source, question_key):
except:
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':
- text_list = source.split('\n')
- tag = ["
"]
- for value in text_list:
- if value and not value.isspace():
- tag.append('- ' + value + '
')
- tag.append('
')
- return ''.join(tag)
+ return reformat_list(source)
return source
@@ -47,6 +41,19 @@ def process_list(lst, question_key):
return ''.join(tag)
+def reformat_list(source):
+ text_list = source.split('\n')
+ if len(text_list) > 1:
+ tag = [""]
+ for value in text_list:
+ if value and not value.isspace():
+ tag.append('- ' + value + '
')
+ tag.append('
')
+ return ''.join(tag)
+ else:
+ return text_list.pop()
+
+
def format_row(question, response):
return '| {0} | {1} |
'.format(
question, response
@@ -170,12 +177,15 @@ def format_children(context, source):
tags.append(format_fact_sheet(question, fact_sheet_mapping[question]))
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
- 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
- item = list(filter(lambda x: x['question_id'] == question, working_source))
-
if len(item):
item = item.pop()
q_id = item['question_id']