Browse Source

DIV-1179: Don't show children section if all children are grown

pull/172/head
ariannedee 5 years ago
parent
commit
20f4eb40b8
7 changed files with 38 additions and 20 deletions
  1. +4
    -4
      edivorce/apps/core/templates/overview.html
  2. +1
    -1
      edivorce/apps/core/templates/partials/progress.html
  3. +3
    -3
      edivorce/apps/core/templates/question/12_review.html
  4. +5
    -8
      edivorce/apps/core/templatetags/step_order.py
  5. +21
    -0
      edivorce/apps/core/tests/test_logic.py
  6. +3
    -1
      edivorce/apps/core/utils/conditional_logic.py
  7. +1
    -3
      edivorce/apps/core/utils/derived.py

+ 4
- 4
edivorce/apps/core/templates/overview.html View File

@ -41,7 +41,7 @@
<span class="progress-content"><small>Step 5</small><br />Your separation</span>
{% include "partials/progress_icon.html" with step_status_string=step_status.your_separation with_status=True %}
</a>
{% if children_of_marriage == 'YES' or derived.has_children_of_marriage %}
{% if derived.has_children_of_marriage %}
<a href="{% url 'question_steps' 'children' 'your_children'%}" class="progress-question {% if step_status.your_children == 'Completed' %} complete {% endif %}">
<span class="progress-icon"><i class="fa fa-users" aria-hidden="true"></i></span>
<span class="progress-content"><small>Step {% step_order step="children" %}</small><br />Your children</span>
@ -49,7 +49,7 @@
</a>
{% endif %}
{% if 'Spousal support' in which_orders.0.value|load_json %}
{% if derived.wants_spousal_support %}
<a href="{% url 'question_steps' 'support' %}" class="progress-question {% if step_status.spousal_support == 'Completed' %} complete {% endif %}">
<span class="progress-icon"><i class="fa fa-life-ring" aria-hidden="true"></i></span>
<span class="progress-content"><small>Step {% step_order step="support" %}</small><br />Spousal support</span>
@ -57,7 +57,7 @@
</a>
{% endif %}
{% if 'Division of property and debts' in which_orders.0.value|load_json %}
{% if derived.wants_property_division %}
<a href="{% url 'question_steps' 'property' %}" class="progress-question {% if step_status.property_and_debt == 'Completed' %} complete {% endif %}">
<span class="progress-icon"><i class="fa fa-home" aria-hidden="true"></i></span>
<span class="progress-content"><small>Step {% step_order step="property" %}</small><br />Property and debt</span>
@ -65,7 +65,7 @@
</a>
{% endif %}
{% if 'Other orders' in which_orders.0.value|load_json %}
{% if derived.wants_other_orders %}
<a href="{% url 'question_steps' 'other_orders' %}" class="progress-question {% if step_status.other_orders == 'Completed' %} complete {% endif %}">
<span class="progress-icon"><i class="fa fa-gavel" aria-hidden="true"></i></span>
<span class="progress-content"><small>Step {% step_order step="other_orders" %}</small><br />Other orders</span>


+ 1
- 1
edivorce/apps/core/templates/partials/progress.html View File

@ -34,7 +34,7 @@
{% include "partials/progress_icon.html" with step_status_string=step_status.your_separation%}
</a>
{% if children_of_marriage == 'YES' or derived.has_children_of_marriage %}
{% if derived.has_children_of_marriage %}
<a href="{% url 'question_steps' 'children' 'your_children' %}" class="progress-question collapse-trigger {% if step_status.your_children == 'Completed' %} complete {% endif %} {% if active_page == 'children' %} active {% endif %}"
data-toggle="collapse" aria-expanded="false" data-target="#children_nav" aria-controls="children_nav">
<span class="progress-icon"><i class="fa fa-users" aria-hidden="true"></i></span>


+ 3
- 3
edivorce/apps/core/templates/question/12_review.html View File

@ -129,7 +129,7 @@
</div>
{% endif %}
{% if 'Spousal support' in which_orders.0.value|load_json %}
{% if derived.wants_spousal_support %}
<div class="question-well step-review {% if step_status.spousal_support != 'Completed' %}error{% endif %}">
<div class="collapse-trigger" data-toggle="collapse" aria-expanded="true" data-target="#review_step_7" aria-controls="collapse_changed_name">
<div>
@ -147,7 +147,7 @@
</div>
{% endif %}
{% if 'Division of property and debts' in which_orders.0.value|load_json %}
{% if derived.wants_property_division %}
<div class="question-well step-review {% if step_status.property_and_debt != 'Completed' %}error{% endif %}">
<div class="collapse-trigger" data-toggle="collapse" aria-expanded="true" data-target="#review_step_8" aria-controls="collapse_changed_name">
<div>
@ -165,7 +165,7 @@
</div>
{% endif %}
{% if 'Other orders' in which_orders.0.value|load_json %}
{% if derived.wants_other_orders %}
<div class="question-well step-review {% if step_status.other_orders != 'Completed' %}error{% endif %}">
<div class="collapse-trigger" data-toggle="collapse" aria-expanded="true" data-target="#review_step_9" aria-controls="collapse_changed_name">
<div>


+ 5
- 8
edivorce/apps/core/templatetags/step_order.py View File

@ -72,23 +72,20 @@ def _adjust_for_orders(next_item, want_which_orders, children_of_marriage=None,
@register.simple_tag(takes_context=True)
def step_order(context, step):
want_which_orders = __parse_json_which_orders_selected(context)
base_order = template_step_order[step]
order = base_order
derived_data = context.get('derived', dict())
if base_order > 5 and (
context.get('children_of_marriage', None) != 'YES' and
context.get('derived', dict()).get('has_children_of_marriage', None) is False
):
if base_order > 5 and not derived_data.get('has_children_of_marriage'):
order -= 1
if base_order > 6 and 'Spousal support' not in want_which_orders:
if base_order > 6 and not derived_data.get('wants_spousal_support'):
order -= 1
if base_order > 7 and 'Division of property and debts' not in want_which_orders:
if base_order > 7 and not derived_data.get('wants_property_division'):
order -= 1
if base_order > 8 and 'Other orders' not in want_which_orders:
if base_order > 8 and not derived_data.get('wants_other_orders'):
order -= 1
return order


+ 21
- 0
edivorce/apps/core/tests/test_logic.py View File

@ -76,6 +76,27 @@ class ConditionalLogicTestCase(TestCase):
self.create_response('claimant_children', json.dumps(children))
self.assertFalse(logic.determine_shared_custody(self.questions_dict))
def test_has_children_of_marriage(self):
self.assertFalse(logic.determine_has_children_of_marriage(self.questions_dict))
self.create_response('children_of_marriage', 'NO')
self.assertFalse(logic.determine_has_children_of_marriage(self.questions_dict))
self.create_response('children_of_marriage', 'YES')
self.create_response('has_children_under_19', 'YES')
self.assertTrue(logic.determine_has_children_of_marriage(self.questions_dict))
self.create_response('has_children_under_19', 'NO')
self.create_response('has_children_over_19', 'NO')
self.assertFalse(logic.determine_has_children_of_marriage(self.questions_dict))
self.create_response('has_children_over_19', 'YES')
self.create_response('children_financial_support', '["NO"]')
self.assertFalse(logic.determine_has_children_of_marriage(self.questions_dict))
self.create_response('children_financial_support', '["Yes, attending post secondary institution"]')
self.assertTrue(logic.determine_has_children_of_marriage(self.questions_dict))
class ViewLogic(TestCase):
def test_content_type_from_filename(self):


+ 3
- 1
edivorce/apps/core/utils/conditional_logic.py View File

@ -14,8 +14,10 @@ def if_no_children(return_val):
return decorator_no_children
@if_no_children(return_val=False)
def determine_has_children_of_marriage(questions_dict):
return questions_dict.get('children_of_marriage', '') == 'YES'
has_under_19 = questions_dict.get('has_children_under_19', '') == 'YES'
return has_under_19 or determine_child_over_19_supported(questions_dict)
@if_no_children(return_val=[])


+ 1
- 3
edivorce/apps/core/utils/derived.py View File

@ -117,9 +117,7 @@ def children(responses, derived):
def has_children_of_marriage(responses, derived):
""" Returns whether or not the their are children of marriage for claim"""
return responses.get('children_of_marriage', '') == 'YES'
return conditional_logic.determine_has_children_of_marriage(responses)
def wants_divorce_order(responses, derived):


Loading…
Cancel
Save