Browse Source

Merge pull request #33 from bcgov/DIV-912

DIV-912 Updated missing stretch of questions
pull/160/head
Charles Shin 6 years ago
committed by GitHub
parent
commit
aedd5497f7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 82 additions and 24 deletions
  1. +15
    -0
      edivorce/apps/core/static/js/functions.js
  2. +9
    -4
      edivorce/apps/core/templates/pdf/form1.html
  3. +5
    -4
      edivorce/apps/core/templates/pdf/form52.html
  4. +17
    -5
      edivorce/apps/core/templates/question/06_children_what_for.html
  5. +3
    -2
      edivorce/apps/core/templatetags/summary_format.py
  6. +1
    -0
      edivorce/apps/core/utils/question_step_mapping.py
  7. +6
    -2
      edivorce/apps/core/utils/step_completeness.py
  8. +4
    -1
      edivorce/apps/core/utils/user_response.py
  9. +22
    -6
      edivorce/fixtures/Question.json

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

@ -91,6 +91,10 @@ var showHideTargetId = function(el, id, relatedId, revealControlGroup) {
if (id === "#has_children") {
reveal($("input[name=number_children_over_19]"));
}
// Special case of hide child support description.
if (id === "#child_support_in_order_detail") {
$("#child_support_description").hide();
}
// reveal nested question as well
if (id === "#marriage_certificate") {
@ -115,6 +119,11 @@ var showHideTargetId = function(el, id, relatedId, revealControlGroup) {
$(el.data("reveal_force_hide_group")).find(':radio').prop('checked', false);
}
// Special case of show child support description.
if (id === "#child_support_in_order_detail") {
$("#child_support_description").show();
}
if (relatedId !== undefined){
$('#' + relatedId).show();
}
@ -147,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();
}
}
}
}
};


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

@ -420,14 +420,14 @@
<tr>
<td colname="c2">
<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>
<div class="td-list-text">
Claimant 1 and Claimant 2 are asking for the following
order respecting arrangements for parenting or
contact:
<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>
{% endif %}
</span>
@ -437,13 +437,18 @@
<tr>
<td colname="c2">
<span class="td-list-item">
B. {% checkbox responses.order_for_child_support children_of_marriage='YES' want_which_orders='Child support' %}
B.
{% if responses.child_support_in_order == 'NO' %}
{% checkbox false %}
{% else %}
{% checkbox responses.order_for_child_support children_of_marriage='YES' want_which_orders='Child support' %}
{% endif %}
</span>
<div class="td-list-text">
Claimant 1 and Claimant 2 are asking for an order for
child support as follows:
<span class="form-entry form-textarea not-complete form-list-textarea">
{% if responses.children_of_marriage == 'YES' and responses.order_for_child_support and 'Child support' in responses.want_which_orders %}
{% if responses.children_of_marriage == 'YES' and responses.order_for_child_support and 'Child support' in responses.want_which_orders and responses.child_support_in_order != 'NO' %}
<ul>{{ responses.order_for_child_support|striptags|linebreaksli }}</ul>
{% endif %}
</span>


+ 5
- 4
edivorce/apps/core/templates/pdf/form52.html View File

@ -112,10 +112,11 @@
{% for order in derived.pursuant_parenting_arrangement %}
<li>{{ order }}</li>
{% endfor %}
{% for order in derived.pursuant_child_support %}
<li>{{ order }}</li>
{% endfor %}
{% if responses.child_support_in_order != 'NO' %}
{% for order in derived.pursuant_child_support %}
<li>{{ order }}</li>
{% endfor %}
{% endif %}
{% endif %}
{% if responses.children_of_marriage == 'YES' and responses.special_extraordinary_expenses == 'YES' %}


+ 17
- 5
edivorce/apps/core/templates/question/06_children_what_for.html View File

@ -177,8 +177,6 @@
</div>
{% if 'Child support' in want_which_orders|load_json %}
<div class="question-well">
<h3>Do you have a
<span class="tooltip-link"
@ -271,8 +269,9 @@
{% input_field type="textarea" name="what_parenting_arrangements" class="response-textarea form-control" maxlength="20000" rows="7"%}
</div>
{% if 'Child support' in want_which_orders|load_json %}
<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"
data-toggle="tooltip" data-placement="right" data-html="true"
title="
@ -286,8 +285,21 @@
</p>
">
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>
<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>
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.
@ -311,7 +323,7 @@
{% input_field type="textarea" name="order_respecting_arrangement" class="response-textarea form-control" maxlength="20000" rows="7"%}
</div>
<div class="question-well">
<div class="question-well" id="child_support_description">
<h3>If you are asking for an
<span class="tooltip-link"
data-toggle="tooltip" data-placement="right" data-html="true"


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

@ -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 = '<tbody>'
# 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(
'{}{}',


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

@ -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',


+ 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
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

+ 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
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'] = ''


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

@ -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"


Loading…
Cancel
Save