Browse Source

DIV-916: Added new question for asking for child support and updated related logics.

pull/160/head
Charles Shin 6 years ago
parent
commit
49253ac71c
8 changed files with 59 additions and 15 deletions
  1. +6
    -0
      edivorce/apps/core/static/js/functions.js
  2. +2
    -2
      edivorce/apps/core/templates/pdf/form1.html
  3. +15
    -2
      edivorce/apps/core/templates/question/06_children_what_for.html
  4. +3
    -2
      edivorce/apps/core/templatetags/summary_format.py
  5. +1
    -0
      edivorce/apps/core/utils/question_step_mapping.py
  6. +6
    -2
      edivorce/apps/core/utils/step_completeness.py
  7. +4
    -1
      edivorce/apps/core/utils/user_response.py
  8. +22
    -6
      edivorce/fixtures/Question.json

+ 6
- 0
edivorce/apps/core/static/js/functions.js View File

@ -156,6 +156,12 @@ var showHideRevealClass = function(el, targetCssClass) {
} else { } else {
if (targetCssClass !== undefined){ if (targetCssClass !== undefined){
$('.' + targetCssClass).show(); $('.' + 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();
}
}
} }
} }
}; };


+ 2
- 2
edivorce/apps/core/templates/pdf/form1.html View File

@ -420,14 +420,14 @@
<tr> <tr>
<td colname="c2"> <td colname="c2">
<span class="td-list-item"> <span class="td-list-item">
A. {% checkbox responses.order_respecting_arrangement children_of_marriage='YES' want_which_orders='Child support' %}
A. {% checkbox want_parenting_arrangements='YES' children_of_marriage='YES' want_which_orders='Child support' %}
</span> </span>
<div class="td-list-text"> <div class="td-list-text">
Claimant 1 and Claimant 2 are asking for the following Claimant 1 and Claimant 2 are asking for the following
order respecting arrangements for parenting or order respecting arrangements for parenting or
contact: contact:
<span class="form-entry form-textarea not-complete form-list-textarea"> <span class="form-entry form-textarea not-complete form-list-textarea">
{% if responses.children_of_marriage == 'YES' and responses.order_respecting_arrangement and 'Child support' in responses.want_which_orders %}
{% if responses.children_of_marriage == 'YES' and responses.want_parenting_arrangements == 'YES' and responses.order_respecting_arrangement and 'Child support' in responses.want_which_orders %}
<ul>{{ responses.order_respecting_arrangement|striptags|linebreaksli }}</ul> <ul>{{ responses.order_respecting_arrangement|striptags|linebreaksli }}</ul>
{% endif %} {% endif %}
</span> </span>


+ 15
- 2
edivorce/apps/core/templates/question/06_children_what_for.html View File

@ -271,7 +271,7 @@
{% if 'Child support' in want_which_orders|load_json %} {% if 'Child support' in want_which_orders|load_json %}
<div class="question-well"> <div class="question-well">
<h3>If you are asking the court to include an
<h3>Are you asking the court for an
<span class="tooltip-link" <span class="tooltip-link"
data-toggle="tooltip" data-placement="right" data-html="true" data-toggle="tooltip" data-placement="right" data-html="true"
title=" title="
@ -285,8 +285,21 @@
</p> </p>
"> ">
order about parenting arrangements or contact <i class="fa fa-question-circle" aria-hidden="true"></i> order about parenting arrangements or contact <i class="fa fa-question-circle" aria-hidden="true"></i>
</span> with a child, please indicate the orders you are asking for below.
</span> with a child?
</h3> </h3>
<div class="btn-radio-group" data-toggle="buttons">
<label class="btn btn-radio">
{% input_field type="radio" name="want_parenting_arrangements" autocomplete="off" value="YES" data_target_id="parenting_arrangement_detail" data_reveal_target="true" %} Yes
</label>
<label class="btn btn-radio">
{% input_field type="radio" name="want_parenting_arrangements" autocomplete="off" value="NO" data_target_id="parenting_arrangement_detail" data_reveal_target="false" %} No
</label>
</div>
</div>
<div class="question-well" id="parenting_arrangement_detail" hidden>
<h3>Please indicate the parenting arrangements you are asking for below.</h3>
<p> <p>
You need to include each of the orders you want pertaining to guardianship, parental responsibilities and 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. parenting time, and contact with the child. You will need to write them as if a Judge is telling you to do it.


+ 3
- 2
edivorce/apps/core/templatetags/summary_format.py View File

@ -128,6 +128,7 @@ def format_children(context, source):
'have_separation_agreement', 'have_separation_agreement',
'have_court_order', 'have_court_order',
'what_parenting_arrangements', 'what_parenting_arrangements',
'want_parenting_arrangements',
'order_respecting_arrangement', 'order_respecting_arrangement',
'order_for_child_support', 'order_for_child_support',
'child_support_act' '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['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']) 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 = '<tbody>' tags = '<tbody>'
# process mapped questions first # 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 # skip child support order related questions if user did not select that option
if question in child_support_orders and len(item): if question in child_support_orders and len(item):
item = item.pop() 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. # make sure free form text is reformted to be bullet list.
tags = format_html( tags = format_html(
'{}{}', '{}{}',


+ 1
- 0
edivorce/apps/core/utils/question_step_mapping.py View File

@ -96,6 +96,7 @@ question_step_mapping = {
'have_separation_agreement', 'have_separation_agreement',
'have_court_order', 'have_court_order',
'what_parenting_arrangements', 'what_parenting_arrangements',
'want_parenting_arrangements',
'order_respecting_arrangement', 'order_respecting_arrangement',
'order_for_child_support', 'order_for_child_support',
'child_support_act', 'child_support_act',


+ 6
- 2
edivorce/apps/core/utils/step_completeness.py View File

@ -103,7 +103,11 @@ def __condition_met(reveal_response, target, lst):
# check whether using a numeric condition # check whether using a numeric condition
numeric_condition_met = evaluate_numeric_condition(target["value"], reveal_response) numeric_condition_met = evaluate_numeric_condition(target["value"], reveal_response)
if numeric_condition_met is None: 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 return False
elif numeric_condition_met is False: elif numeric_condition_met is False:
return False return False
@ -129,6 +133,6 @@ def __has_value(key, lst):
for user_response in lst: for user_response in lst:
if user_response["question_id"] == key: if user_response["question_id"] == key:
answer = user_response["value"] answer = user_response["value"]
if answer != "" and answer != "[]" and answer != '[["",""]]':
if answer != "" and answer != "[]" and answer != '[["",""]]' and answer != "\n":
return True return True
return False return False

+ 4
- 1
edivorce/apps/core/utils/user_response.py View File

@ -75,7 +75,10 @@ def get_responses_from_db_grouped_by_steps(bceid_user, hide_failed_conditionals=
continue continue
numeric_condition = evaluate_numeric_condition(values[target], q['question__reveal_response']) numeric_condition = evaluate_numeric_condition(values[target], q['question__reveal_response'])
if numeric_condition is None: 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'] = '' q['value'] = ''
elif numeric_condition is False: elif numeric_condition is False:
q['value'] = '' q['value'] = ''


+ 22
- 6
edivorce/fixtures/Question.json View File

@ -847,12 +847,24 @@
}, },
{ {
"fields": { "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", "description": "For Step 6, Your children - What are you asking for",
"summary_order": 0, "summary_order": 0,
"required": "Required" "required": "Required"
}, },
"model": "core.question", "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" "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.", "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", "description": "For Step 6, Your children - What are you asking for",
"summary_order": 0, "summary_order": 0,
"required": "Required"
"required": "Conditional",
"conditional_target": "child_support_in_order",
"reveal_response": "!NO"
}, },
"model": "core.question", "model": "core.question",
"pk": "order_for_child_support" "pk": "order_for_child_support"
@ -1808,7 +1822,9 @@
"name": "We are not asking for child support to be included in the order", "name": "We are not asking for child support to be included in the order",
"description": "For Step 6, Your children - Payor & medical expenses", "description": "For Step 6, Your children - Payor & medical expenses",
"summary_order": 0, "summary_order": 0,
"required": "Conditional"
"required": "Conditional",
"conditional_target": "child_support_in_order",
"reveal_response": "NO"
}, },
"model": "core.question", "model": "core.question",
"pk": "child_support_in_order_reason" "pk": "child_support_in_order_reason"
@ -1820,7 +1836,7 @@
"summary_order": 0, "summary_order": 0,
"required": "Conditional", "required": "Conditional",
"conditional_target": "child_support_in_order", "conditional_target": "child_support_in_order",
"reveal_response": "[DIFF]"
"reveal_response": "DIFF"
}, },
"model": "core.question", "model": "core.question",
"pk": "claimants_agree_to_child_support_amount" "pk": "claimants_agree_to_child_support_amount"
@ -1831,8 +1847,8 @@
"description": "For Step 6, Your children - Payor & medical expenses", "description": "For Step 6, Your children - Payor & medical expenses",
"summary_order": 0, "summary_order": 0,
"required": "Conditional", "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", "model": "core.question",
"pk": "child_support_payment_special_provisions" "pk": "child_support_payment_special_provisions"


Loading…
Cancel
Save