+
Special or Extraordinary Expenses (Fact Sheet A){% if derived.fact_sheet_a_error %}{% include 'partials/required.html' %}{% endif %}
Since you have indicated that there are special or extraordinary expenses, we need you to answer the next set of questions.
- {% if derived.special_expenses_missing_error %}
+ {% if derived.fact_sheet_a_error %}
* At least one of these values must be greater than 0
{% endif %}
diff --git a/edivorce/apps/core/templatetags/summary_format.py b/edivorce/apps/core/templatetags/summary_format.py
index 6efb99b2..71dc3f3d 100644
--- a/edivorce/apps/core/templatetags/summary_format.py
+++ b/edivorce/apps/core/templatetags/summary_format.py
@@ -155,12 +155,13 @@ def format_review_row_heading(title, style="", substep=None):
)
-def format_fact_sheet(title, url, style=''):
+def format_fact_sheet(title, url, value):
return format_html(
- '| {2} |
',
- style,
+ '| {} | {} |
',
url,
- title)
+ title,
+ value
+ )
@register.simple_tag(takes_context=True)
@@ -237,25 +238,35 @@ def format_children(context, source):
for question in questions:
if question in fact_sheet_mapping:
show_fact_sheet = False
+ fact_sheet_error = False
if question == 'Special or Extraordinary Expenses (Fact Sheet A)' and context['derived']['show_fact_sheet_a']:
show_fact_sheet = True
+ fact_sheet_error = context['derived']['fact_sheet_a_error']
elif question == 'Shared Living Arrangement (Fact Sheet B)' and context['derived']['show_fact_sheet_b']:
show_fact_sheet = True
+ fact_sheet_error = context['derived']['fact_sheet_b_error']
elif question == 'Split Living Arrangement (Fact Sheet C)' and context['derived']['show_fact_sheet_c']:
show_fact_sheet = True
+ fact_sheet_error = context['derived']['fact_sheet_c_error']
elif question == 'Child(ren) 19 Years or Older (Fact Sheet D)' and context['derived']['show_fact_sheet_d']:
show_fact_sheet = True
+ fact_sheet_error = context['derived']['fact_sheet_d_error']
elif question == 'Undue Hardship (Fact Sheet E)' and context['derived']['show_fact_sheet_e']:
show_fact_sheet = True
- elif question == 'Income over $150,000 (Fact Sheet F)' and (
- context['derived']['show_fact_sheet_f_you'] or context['derived']['show_fact_sheet_f_spouse']):
+ fact_sheet_error = context['derived']['fact_sheet_e_error']
+ elif question == 'Income over $150,000 (Fact Sheet F)' and context['derived']['show_fact_sheet_f']:
show_fact_sheet = True
+ fact_sheet_error = context['derived']['fact_sheet_f_error']
if show_fact_sheet and len(fact_sheet_mapping[question]):
+ if fact_sheet_error:
+ value = MISSING_RESPONSE
+ else:
+ value = 'Complete'
tags = format_html(
'{}{}',
tags,
- format_fact_sheet(question, fact_sheet_mapping[question]))
+ format_fact_sheet(question, fact_sheet_mapping[question], value))
else:
item_list = list(filter(lambda x: x['question_id'] == question, working_source))
diff --git a/edivorce/apps/core/utils/derived.py b/edivorce/apps/core/utils/derived.py
index 3cad961e..9ee67308 100644
--- a/edivorce/apps/core/utils/derived.py
+++ b/edivorce/apps/core/utils/derived.py
@@ -34,6 +34,7 @@ DERIVED_DATA = [
'wants_child_support',
'wants_other_orders',
'show_fact_sheet_a',
+ 'fact_sheet_a_error',
'show_fact_sheet_b',
'fact_sheet_b_error',
'show_fact_sheet_c',
@@ -86,7 +87,6 @@ DERIVED_DATA = [
'pursuant_parenting_arrangement',
'pursuant_child_support',
'sole_custody',
- 'special_expenses_missing_error',
]
@@ -160,6 +160,10 @@ def show_fact_sheet_a(responses, derived):
return responses.get('special_extraordinary_expenses', '') == 'YES'
+def fact_sheet_a_error(responses, derived):
+ return determine_missing_extraordinary_expenses(responses)
+
+
def show_fact_sheet_b(responses, derived):
"""
If any child lives with both parents, custody is shared, so Fact Sheet B
@@ -263,6 +267,7 @@ def fact_sheet_f_error(responses, derived):
if show_fact_sheet_f_spouse(responses, derived):
if _any_question_errors(responses, fields_for_spouse):
return True
+ return False
def has_fact_sheets(responses, derived):
@@ -739,10 +744,6 @@ def sole_custody(responses, derived):
return conditional_logic.determine_sole_custody(responses)
-def special_expenses_missing_error(responses, derived):
- return determine_missing_extraordinary_expenses(responses)
-
-
def _any_question_errors(responses, questions):
for field in questions:
error_field_name = f'{field}_error'
diff --git a/edivorce/apps/core/utils/step_completeness.py b/edivorce/apps/core/utils/step_completeness.py
index 343b785d..ded8b269 100644
--- a/edivorce/apps/core/utils/step_completeness.py
+++ b/edivorce/apps/core/utils/step_completeness.py
@@ -84,15 +84,19 @@ def get_formatted_incomplete_list(missed_question_keys):
return missed_questions
-def get_error_dict(questions_by_step, step, substep=None):
+def get_error_dict(questions_by_step, step=None, substep=None):
"""
Accepts questions dict of {step: [{question_dict}]} and a step (and substep)
Returns a dict of {question_key_error: True} for missing questions that are part of that step (and substep)
"""
responses_dict = {}
- question_step = page_step_mapping[step]
- step_questions = questions_by_step.get(question_step)
-
+ if step:
+ question_step = page_step_mapping[step]
+ step_questions = questions_by_step.get(question_step)
+ else:
+ step_questions = []
+ for questions in questions_by_step.values():
+ step_questions.extend(questions)
# Since the Your children substep only has one question, show error if future children questions have been answered
children_substep_and_step_started = substep == 'your_children' and step_started(step_questions)
diff --git a/edivorce/apps/core/views/main.py b/edivorce/apps/core/views/main.py
index 540bd78f..ac2e62dd 100644
--- a/edivorce/apps/core/views/main.py
+++ b/edivorce/apps/core/views/main.py
@@ -199,6 +199,7 @@ def question(request, step, sub_step=None):
data_dict = get_data_for_user(request.user)
responses_dict_by_step = get_step_responses(data_dict)
step_status = get_step_completeness(responses_dict_by_step)
+ data_dict.update(get_error_dict(responses_dict_by_step))
derived = get_derived_data(data_dict)
responses_dict = responses_dict_by_step
else: