Browse Source

DIV-687: Show payor name in review screen

pull/160/head
Benard Ebinu 7 years ago
parent
commit
7bbf60f51d
2 changed files with 25 additions and 4 deletions
  1. +9
    -4
      edivorce/apps/core/templatetags/summary_format.py
  2. +16
    -0
      edivorce/apps/core/utils/derived.py

+ 9
- 4
edivorce/apps/core/templatetags/summary_format.py View File

@ -126,7 +126,7 @@ def format_children(context, source):
'child_support_arrears_amount' 'child_support_arrears_amount'
] ]
question_to_heading['What are you asking for?'] = [ question_to_heading['What are you asking for?'] = [
'child_support_in_order',
# 'child_support_in_order',
'order_monthly_child_support_amount', 'order_monthly_child_support_amount',
'child_support_in_order_reason', 'child_support_in_order_reason',
'does_payour_amount_match_guidelines', 'does_payour_amount_match_guidelines',
@ -183,6 +183,7 @@ def format_children(context, source):
if question in child_support_orders: if question in child_support_orders:
item = item.pop() item = item.pop()
if context['derived']['wants_child_support'] is True: if context['derived']['wants_child_support'] is True:
# make sure free form text is reformted to be bullet list.
tags.append(format_row(item['question__name'], reformat_list(item['value']))) tags.append(format_row(item['question__name'], reformat_list(item['value'])))
continue continue
@ -206,13 +207,17 @@ def format_children(context, source):
value = json.loads(item['value']) value = json.loads(item['value'])
except: except:
pass pass
question_name = item['question__name']
if question == 'order_monthly_child_support_amount':
question_name = '{} {}'.format(question_name, context['derived']['child_support_payor_by_name'])
if isinstance(value, list): if isinstance(value, list):
tags.append(format_row(item['question__name'], process_list(value, q_id)))
tags.append(format_row(question_name, process_list(value, q_id)))
elif isinstance(value, str): elif isinstance(value, str):
if len(value): if len(value):
tags.append(format_row(item['question__name'], value))
tags.append(format_row(question_name, value))
else: else:
tags.append(format_row(item['question__name'], value))
tags.append(format_row(question_name, value))
tags.append('</tbody>') tags.append('</tbody>')
tags.append('<tbody class="review-table-spacer">') tags.append('<tbody class="review-table-spacer">')
tags.append('</tbody>') tags.append('</tbody>')


+ 16
- 0
edivorce/apps/core/utils/derived.py View File

@ -33,6 +33,7 @@ DERIVED_DATA = [
'has_fact_sheets', 'has_fact_sheets',
'schedule_1_amount', 'schedule_1_amount',
'child_support_payor', 'child_support_payor',
'child_support_payor_by_name',
'annual_child_care_expenses', 'annual_child_care_expenses',
'annual_children_healthcare_premiums', 'annual_children_healthcare_premiums',
'annual_health_related_expenses', 'annual_health_related_expenses',
@ -240,6 +241,21 @@ def child_support_payor(responses, derived):
return '' return ''
def child_support_payor_by_name(responses, derived):
""" Return the payor by name"""
payor = 'the payor'
support_payor = child_support_payor(responses, derived)
if support_payor == 'Claimant 1':
payor = responses.get('name_you', support_payor)
elif support_payor == 'Claimant 2':
payor = responses.get('name_spouse', support_payor)
elif support_payor == 'both Claimant 1 and Claimant 2':
payor = '{} and {}'.format(responses.get('name_you', 'myself'),
responses.get('name_spouse', 'my spouse'))
return payor
def annual_child_care_expenses(responses, derived): def annual_child_care_expenses(responses, derived):
""" Return the annual cost of the monthly cost of child care expense """ """ Return the annual cost of the monthly cost of child care expense """


Loading…
Cancel
Save