Browse Source

Merge pull request #104 from bcgov/DIV-1131

DIV-1131: Fix children_live_with_others requirements
pull/170/head
Michael Olund 5 years ago
committed by GitHub
parent
commit
7c55ea36cb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 91 additions and 14 deletions
  1. +0
    -6
      edivorce/apps/core/static/js/functions.js
  2. +15
    -0
      edivorce/apps/core/static/js/main.js
  3. +7
    -7
      edivorce/apps/core/templates/prequalification/step_04.html
  4. +59
    -0
      edivorce/apps/core/tests/test_step_completeness.py
  5. +7
    -0
      edivorce/apps/core/utils/conditional_logic.py
  6. +3
    -1
      edivorce/fixtures/Question.json

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

@ -144,12 +144,6 @@ var showHideTargetId = function(el, id, relatedId, revealControlGroup) {
$(el.data("reveal_force_hide_group")).hide();
$(el.data("reveal_force_hide_group")).find(':radio').prop('checked', false);
}
// Special case of pre-qualification step 4 children.
if (id === "#has_children") {
if (el.val() === 'NO') {
$('.not-disqualified-other').show();
}
}
// Special case of show child support description.
if (id === "#child_support_in_order_detail") {


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

@ -744,6 +744,21 @@ $(function () {
}
});
// For Prequalification step 4
// If they have children under 19 or are financially supporting children over 19, show question children_live_with_others
var showHideChildrenLiveWithOthers = function() {
var childrenUnder19 = $('input[name="has_children_under_19"][value="YES"]').prop('checked');
var childrenOver19 = $('input[name="has_children_over_19"][value="YES"]').prop('checked');
var notSupportingOver19 = $('input#no_children_financial_support').prop('checked');
if (childrenUnder19 || (childrenOver19 && !notSupportingOver19)) {
$('#children_live_with_others').show();
} else {
$('#children_live_with_others').hide();
}
}
showHideChildrenLiveWithOthers();
$('input[name="has_children_under_19"], input[name="has_children_over_19"], input[name="children_financial_support"]').change(showHideChildrenLiveWithOthers);
$('.money').on('change', function() {
var value = parseFloat($(this).val());


+ 7
- 7
edivorce/apps/core/templates/prequalification/step_04.html View File

@ -155,12 +155,12 @@
<div class="btn-radio-group" data-toggle="buttons">
<label class="btn btn-radio">
{% input_field type="radio" name="has_children_over_19" autocomplete="off" value="YES" data_target_id="financial_support" data_reveal_class="true" data_target_class="not-disqualified-age" data_reveal_target="true" %}
{% input_field type="radio" name="has_children_over_19" autocomplete="off" value="YES" data_target_id="financial_support" data_reveal_target="true" %}
Yes
</label>
<label class="btn btn-radio">
{% input_field type="radio" name="has_children_over_19" autocomplete="off" value="NO" data_target_id="financial_support" data_reveal_class="true" data_target_class="not-disqualified-age" data_reveal_target="false" %}
{% input_field type="radio" name="has_children_over_19" autocomplete="off" value="NO" data_target_id="financial_support" data_reveal_target="false" %}
No
</label>
</div>
@ -171,11 +171,11 @@
years or older?</h3>
<p>Please check all that apply.</p>
<div class="checkbox-group">
<div class="checkbox"><label>{% input_field type="checkbox" name="children_financial_support" value="NO" data_checkbox_radio="true" data_checkbox_radio_state_set="false" data_target_id="children_live_with_others" data_reveal_target="false" data_target_class="not-disqualified-other" data_reveal_class="true" %}No</label></div>
<div class="checkbox"><label>{% input_field type="checkbox" name="children_financial_support" value="Yes, attending post secondary institution" data_checkbox_radio="true" data_checkbox_radio_state_set="true" data_target_id="children_live_with_others" data_reveal_target="true" %}Yes, attending post secondary institution</label></div>
<div class="checkbox"><label>{% input_field type="checkbox" name="children_financial_support" value="Yes, due to disability" data_checkbox_radio="true" data_checkbox_radio_state_set="true" data_target_id="children_live_with_others" data_reveal_target="true" %}Yes, due to disability</label></div>
<div class="checkbox"><label>{% input_field type="checkbox" name="children_financial_support" value="Yes, due to illness" data_checkbox_radio="true" data_checkbox_radio_state_set="true" data_target_id="children_live_with_others" data_reveal_target="true" %}Yes, due to illness</label></div>
<div class="checkbox"><label>{% input_field type="checkbox" name="children_financial_support" value="Yes, other reason" data_checkbox_radio="true" data_checkbox_radio_state_set="true" data_target_id="children_live_with_others" data_reveal_target="true" %}Yes, other reason(s)</label></div>
<div class="checkbox"><label>{% input_field type="checkbox" name="children_financial_support" value="NO" id="no_children_financial_support" data_checkbox_radio="true" data_checkbox_radio_state_set="false" %}No</label></div>
<div class="checkbox"><label>{% input_field type="checkbox" name="children_financial_support" value="Yes, attending post secondary institution" data_checkbox_radio="true" data_checkbox_radio_state_set="true" %}Yes, attending post secondary institution</label></div>
<div class="checkbox"><label>{% input_field type="checkbox" name="children_financial_support" value="Yes, due to disability" data_checkbox_radio="true" data_checkbox_radio_state_set="true" %}Yes, due to disability</label></div>
<div class="checkbox"><label>{% input_field type="checkbox" name="children_financial_support" value="Yes, due to illness" data_checkbox_radio="true" data_checkbox_radio_state_set="true" %}Yes, due to illness</label></div>
<div class="checkbox"><label>{% input_field type="checkbox" name="children_financial_support" value="Yes, other reason" data_checkbox_radio="true" data_checkbox_radio_state_set="true" %}Yes, other reason(s)</label></div>
</div>
<div class="collapse-trigger collapsed" data-toggle="collapse"
aria-expanded="false" data-target="#collapse_circumstances_change_child_support"


+ 59
- 0
edivorce/apps/core/tests/test_step_completeness.py View File

@ -22,6 +22,65 @@ class StepCompletenessTestCase(TestCase):
def create_response(self, question, value):
UserResponse.objects.create(bceid_user=self.user, question=Question.objects.get(key=question), value=value)
def test_prequalification(self):
step = 'prequalification'
# No response should be False
self.assertEqual(self.check_completeness(step), False)
# Testing required questions
# Missing few required questions
self.create_response('married_marriage_like', 'Legally married')
self.create_response('lived_in_bc', 'YES')
self.create_response('lived_in_bc_at_least_year', 'YES')
self.create_response('separation_date', '11/11/1111')
self.create_response('try_reconcile_after_separated', 'NO')
self.create_response('children_of_marriage', 'NO')
self.create_response('original_marriage_certificate', 'YES')
self.create_response('marriage_certificate_in_english', 'YES')
self.assertEqual(self.check_completeness(step), False)
# All required questions with one checking question with hidden question not shown
self.create_response('divorce_reason', 'live separate')
self.assertEqual(self.check_completeness(step), True)
# Reconciliation
UserResponse.objects.filter(question_id='try_reconcile_after_separated').update(value="YES")
self.assertEqual(self.check_completeness(step), False)
self.create_response('reconciliation_period', '[("11/11/2011","12/11/2011")]')
self.assertEqual(self.check_completeness(step), True)
# Children
UserResponse.objects.filter(question_id='children_of_marriage').update(value="YES")
self.assertEqual(self.check_completeness(step), False)
self.create_response('has_children_under_19', 'NO')
self.create_response('has_children_over_19', 'NO')
self.assertEqual(self.check_completeness(step), True)
UserResponse.objects.filter(question_id='has_children_under_19').update(value="YES")
self.assertEqual(self.check_completeness(step), False)
self.create_response('children_live_with_others', 'NO')
self.assertEqual(self.check_completeness(step), True)
UserResponse.objects.filter(question_id='has_children_over_19').update(value="YES")
self.assertEqual(self.check_completeness(step), False)
self.create_response('children_financial_support', '["NO"]')
self.assertEqual(self.check_completeness(step), True)
# Marriage certificate
UserResponse.objects.filter(question_id='original_marriage_certificate').update(value="NO")
self.assertEqual(self.check_completeness(step), False)
self.create_response('provide_certificate_later', 'YES')
self.assertEqual(self.check_completeness(step), False)
self.create_response('provide_certificate_later_reason', 'Because')
self.assertEqual(self.check_completeness(step), True)
UserResponse.objects.filter(question_id='provide_certificate_later').update(value="NO")
self.assertEqual(self.check_completeness(step), False)
self.create_response('not_provide_certificate_reason', 'Because')
self.assertEqual(self.check_completeness(step), True)
def test_which_order(self):
step = 'which_orders'


+ 7
- 0
edivorce/apps/core/utils/conditional_logic.py View File

@ -131,6 +131,13 @@ def determine_missing_extraordinary_expenses(questions_dict):
return False
def determine_show_children_live_with_others(questions_dict):
has_children_of_marriage = questions_dict.get('children_of_marriage', '') == 'YES'
has_children_under_19 = questions_dict.get('has_children_under_19', '') == 'YES'
child_over_19_supported = determine_child_over_19_supported(questions_dict)
return has_children_of_marriage and (has_children_under_19 or child_over_19_supported)
def get_cleaned_response_value(response):
if response is None:
return None


+ 3
- 1
edivorce/fixtures/Question.json View File

@ -112,7 +112,9 @@
"name": "Do any of the your children live with someone who is not you or your spouse?",
"description": "For pre-qualification step 4, determines eligibility of using the app",
"summary_order": 11,
"required": ""
"required": "Conditional",
"conditional_target": "determine_show_children_live_with_others",
"reveal_response": "True"
},
"model": "core.question",
"pk": "children_live_with_others"


Loading…
Cancel
Save