diff --git a/edivorce/apps/core/static/js/functions.js b/edivorce/apps/core/static/js/functions.js index 3b0c9a03..399a3618 100644 --- a/edivorce/apps/core/static/js/functions.js +++ b/edivorce/apps/core/static/js/functions.js @@ -156,6 +156,12 @@ var showHideRevealClass = function(el, targetCssClass) { } else { if (targetCssClass !== undefined){ $('.' + targetCssClass).show(); + // This is to handle special case where multiple reveal options applied. + if (targetCssClass === 'support-amount-match') { + if ($("input[name=claimants_agree_to_child_support_amount]:checked").val() === 'YES') { + $('#what_special_provisions').hide(); + } + } } } }; diff --git a/edivorce/apps/core/templates/pdf/form1.html b/edivorce/apps/core/templates/pdf/form1.html index 315ca524..bd6d3580 100644 --- a/edivorce/apps/core/templates/pdf/form1.html +++ b/edivorce/apps/core/templates/pdf/form1.html @@ -420,14 +420,14 @@
You need to include each of the orders you want pertaining to guardianship, parental responsibilities and parenting time, and contact with the child. You will need to write them as if a Judge is telling you to do it. diff --git a/edivorce/apps/core/templatetags/summary_format.py b/edivorce/apps/core/templatetags/summary_format.py index fccb5bf1..6b5867d2 100644 --- a/edivorce/apps/core/templatetags/summary_format.py +++ b/edivorce/apps/core/templatetags/summary_format.py @@ -128,6 +128,7 @@ def format_children(context, source): 'have_separation_agreement', 'have_court_order', 'what_parenting_arrangements', + 'want_parenting_arrangements', 'order_respecting_arrangement', 'order_for_child_support', 'child_support_act' @@ -141,7 +142,7 @@ def format_children(context, source): fact_sheet_mapping['Undue Hardship (Fact Sheet E)'] = reverse('question_steps', args=['children', 'facts']) fact_sheet_mapping['Income over $150,000 (Fact Sheet F)'] = reverse('question_steps', args=['children', 'facts']) - child_support_orders = {'have_court_order', 'what_parenting_arrangements', 'order_respecting_arrangement', 'order_for_child_support'} + child_support_orders = {'want_parenting_arrangements', 'order_respecting_arrangement', 'order_for_child_support'} tags = '
' # process mapped questions first @@ -181,7 +182,7 @@ def format_children(context, source): # skip child support order related questions if user did not select that option if question in child_support_orders and len(item): item = item.pop() - if context['derived']['wants_child_support'] is True: + if context['derived']['wants_child_support'] is True and item['value']: # make sure free form text is reformted to be bullet list. tags = format_html( '{}{}', diff --git a/edivorce/apps/core/utils/question_step_mapping.py b/edivorce/apps/core/utils/question_step_mapping.py index 8d6e91b9..cf88bdf9 100644 --- a/edivorce/apps/core/utils/question_step_mapping.py +++ b/edivorce/apps/core/utils/question_step_mapping.py @@ -96,6 +96,7 @@ question_step_mapping = { 'have_separation_agreement', 'have_court_order', 'what_parenting_arrangements', + 'want_parenting_arrangements', 'order_respecting_arrangement', 'order_for_child_support', 'child_support_act', diff --git a/edivorce/apps/core/utils/step_completeness.py b/edivorce/apps/core/utils/step_completeness.py index 757d7ca2..e5a69e66 100644 --- a/edivorce/apps/core/utils/step_completeness.py +++ b/edivorce/apps/core/utils/step_completeness.py @@ -103,7 +103,11 @@ def __condition_met(reveal_response, target, lst): # check whether using a numeric condition numeric_condition_met = evaluate_numeric_condition(target["value"], reveal_response) if numeric_condition_met is None: - if target["value"] != reveal_response: + # handle special negation options. ex) '!NO' matches anything but 'NO' + if reveal_response.startswith('!'): + if target["value"] == "" or target["value"] == reveal_response[1:]: + return False + elif target["value"] != reveal_response: return False elif numeric_condition_met is False: return False @@ -129,6 +133,6 @@ def __has_value(key, lst): for user_response in lst: if user_response["question_id"] == key: answer = user_response["value"] - if answer != "" and answer != "[]" and answer != '[["",""]]': + if answer != "" and answer != "[]" and answer != '[["",""]]' and answer != "\n": return True return False diff --git a/edivorce/apps/core/utils/user_response.py b/edivorce/apps/core/utils/user_response.py index 884a49f4..3ae97993 100644 --- a/edivorce/apps/core/utils/user_response.py +++ b/edivorce/apps/core/utils/user_response.py @@ -75,7 +75,10 @@ def get_responses_from_db_grouped_by_steps(bceid_user, hide_failed_conditionals= continue numeric_condition = evaluate_numeric_condition(values[target], q['question__reveal_response']) if numeric_condition is None: - if q['question__reveal_response'] and q['question__reveal_response'] != values[target]: + if q['question__reveal_response'].startswith('!'): + if values[target] == "" or values[target] == q['question__reveal_response'][1:]: + q['value'] = '' + elif q['question__reveal_response'] and q['question__reveal_response'] != values[target]: q['value'] = '' elif numeric_condition is False: q['value'] = '' diff --git a/edivorce/fixtures/Question.json b/edivorce/fixtures/Question.json index f9d0a105..e49abcea 100644 --- a/edivorce/fixtures/Question.json +++ b/edivorce/fixtures/Question.json @@ -847,12 +847,24 @@ }, { "fields": { - "name": "If you are asking the court to include an order about parenting arrangements or contact with a child, please indicate the orders you are asking for below.", + "name": "Are you asking the court for an order about parenting arrangements or contact with a child?", "description": "For Step 6, Your children - What are you asking for", "summary_order": 0, "required": "Required" }, "model": "core.question", + "pk": "want_parenting_arrangements" +}, +{ + "fields": { + "name": "Please indicate the parenting arrangements you are asking for below.", + "description": "For Step 6, Your children - What are you asking for", + "summary_order": 0, + "required": "Conditional", + "conditional_target": "want_parenting_arrangements", + "reveal_response": "YES" + }, + "model": "core.question", "pk": "order_respecting_arrangement" }, { @@ -860,7 +872,9 @@ "name": "If you are asking for an order for child support please describe what you are asking for.", "description": "For Step 6, Your children - What are you asking for", "summary_order": 0, - "required": "Required" + "required": "Conditional", + "conditional_target": "child_support_in_order", + "reveal_response": "!NO" }, "model": "core.question", "pk": "order_for_child_support" @@ -1808,7 +1822,9 @@ "name": "We are not asking for child support to be included in the order", "description": "For Step 6, Your children - Payor & medical expenses", "summary_order": 0, - "required": "Conditional" + "required": "Conditional", + "conditional_target": "child_support_in_order", + "reveal_response": "NO" }, "model": "core.question", "pk": "child_support_in_order_reason" @@ -1820,7 +1836,7 @@ "summary_order": 0, "required": "Conditional", "conditional_target": "child_support_in_order", - "reveal_response": "[DIFF]" + "reveal_response": "DIFF" }, "model": "core.question", "pk": "claimants_agree_to_child_support_amount" @@ -1831,8 +1847,8 @@ "description": "For Step 6, Your children - Payor & medical expenses", "summary_order": 0, "required": "Conditional", - "conditional_target": "[claimants_agree_to_child_support_amount,child_support_in_order]", - "reveal_response": "[NO,DIFF]" + "conditional_target": "claimants_agree_to_child_support_amount", + "reveal_response": "NO" }, "model": "core.question", "pk": "child_support_payment_special_provisions"