From 18ab9b5afd0de9cca1de638f57c15a9424a4e655 Mon Sep 17 00:00:00 2001 From: Benard Ebinu Date: Thu, 1 Mar 2018 00:19:04 -0800 Subject: [PATCH] DIV-826: display fact sheet D under appropriate conditions --- .../apps/core/templates/question/06_children_facts.html | 2 +- edivorce/apps/core/templatetags/format_utils.py | 3 --- edivorce/apps/core/utils/derived.py | 7 ++++++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/edivorce/apps/core/templates/question/06_children_facts.html b/edivorce/apps/core/templates/question/06_children_facts.html index a3d6c580..c90ddf50 100644 --- a/edivorce/apps/core/templates/question/06_children_facts.html +++ b/edivorce/apps/core/templates/question/06_children_facts.html @@ -416,7 +416,7 @@ -{% if children_of_marriage == 'YES' and 'NO' not in children_financial_support %} +{% if children_of_marriage == 'YES' and 'NO' not in children_financial_support|load_json and number_children_over_19|integer > 0 %}

Child(ren) 19 Years or Older (Fact Sheet D)

diff --git a/edivorce/apps/core/templatetags/format_utils.py b/edivorce/apps/core/templatetags/format_utils.py index f74de2a9..d5425718 100644 --- a/edivorce/apps/core/templatetags/format_utils.py +++ b/edivorce/apps/core/templatetags/format_utils.py @@ -165,9 +165,6 @@ def integer(value): """ Return value as an int or nothing """ try: - print(value) - print(float(value)) - print(int(float(value))) return int(float(value)) except ValueError: return '' diff --git a/edivorce/apps/core/utils/derived.py b/edivorce/apps/core/utils/derived.py index 94efc233..4e2dac71 100644 --- a/edivorce/apps/core/utils/derived.py +++ b/edivorce/apps/core/utils/derived.py @@ -172,8 +172,13 @@ def show_fact_sheet_d(responses, derived): over 19, Fact Sheet D is indicated. """ + try: + children_over_19 = float(responses.get('number_children_over_19', 0)) + except ValueError: + children_over_19 = 0 + support = json.loads(responses.get('children_financial_support', '[]')) - return (len(support) > 0 and + return (len(support) > 0 and children_over_19 > 0 and 'NO' not in support and has_children_of_marriage(responses, derived))