Browse Source

Merge pull request #34 from bcgov/DIV-912

DIV-912 Fixed the issues related to recent updates
pull/160/head
Charles Shin 6 years ago
committed by GitHub
parent
commit
a6a867ff6c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 16 deletions
  1. +3
    -3
      edivorce/apps/core/templates/question/06_children_what_for.html
  2. +9
    -2
      edivorce/apps/core/templatetags/summary_format.py
  3. +25
    -9
      edivorce/apps/core/utils/step_completeness.py
  4. +3
    -2
      edivorce/fixtures/Question.json

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

@ -178,7 +178,7 @@
</div>
<div class="question-well">
<h3>Do you have a
<h3>Do you have an
<span class="tooltip-link"
data-toggle="tooltip" data-placement="right" data-html="true"
title="
@ -188,8 +188,8 @@
basis to help cover the costs of supporting the children.
</p>
">
court order <i class="fa fa-question-circle" aria-hidden="true"></i>
</span>(Provincial or Supreme Court) about parenting and support of the children?</h3>
order <i class="fa fa-question-circle" aria-hidden="true"></i>
</span>(Provincial or Supreme Court) about support of the children?</h3>
<div class="btn-radio-group" data-toggle="buttons">
<label class="btn btn-radio">
{% input_field type="radio" name="have_court_order" autocomplete="off" value="YES" data_target_id="court_order_details" data_reveal_target="true" %} Yes


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

@ -144,7 +144,7 @@ def format_children(context, source):
child_support_orders = {'want_parenting_arrangements', 'order_respecting_arrangement', 'order_for_child_support'}
tags = '<tbody>'
tags = format_html('<tbody>')
# process mapped questions first
working_source = source.copy()
for title, questions in question_to_heading.items():
@ -198,7 +198,8 @@ def format_children(context, source):
child_counter = 1
for child in json.loads(item['value']):
tags = format_html(
'{}{}{}{}{}{}',
'{}{}{}{}{}{}{}',
tags,
format_review_row_heading('Child {}'.format(child_counter), 'review-child-heading'),
format_row('Child\'s name', child['child_name']),
format_row('Birth date', child['child_birth_date']),
@ -210,6 +211,12 @@ def format_children(context, source):
value = item['value']
if q_id == 'describe_order_special_extra_expenses':
pass
if q_id == 'payor_monthly_child_support_amount':
# Only display this field if it is sole custody
sole_custody = (all([child['child_live_with'] == 'Lives with you' for child in context['derived']['children']]) or
all([child['child_live_with'] == 'Lives with spouse' for child in context['derived']['children']]))
if not sole_custody:
continue
try:
value = json.loads(item['value'])


+ 25
- 9
edivorce/apps/core/utils/step_completeness.py View File

@ -1,3 +1,4 @@
import ast
from django.urls import reverse
from edivorce.apps.core.models import Question
@ -66,15 +67,30 @@ def is_complete(step, lst):
missing_responses += [question_key]
for question in conditional_list:
# find the response to the conditional target
for target in lst:
if target["question_id"] == question.conditional_target:
if __condition_met(question.reveal_response, target, lst):
# the condition was met then the question is required.
# ... so check if it has a value
if not __has_value(question.key, lst):
complete = False
missing_responses += [question.key]
# check condition for payor_monthly_child_support_amount
# which needs sole_custody to be computed separately
# payor_monthly_child_support_ammount is required only if sole_custody is True
if question.key == "payor_monthly_child_support_amount":
for target in lst:
if target["question_id"] == "claimant_children":
child_list = ast.literal_eval(target['value'])
sole_custody = (all([child['child_live_with'] == 'Lives with you' for child in child_list]) or
all([child['child_live_with'] == 'Lives with spouse' for child in child_list]))
if sole_custody:
if not __has_value(question.key, lst):
complete = False
missing_responses += [question.key]
break
else:
# find the response to the conditional target
for target in lst:
if target["question_id"] == question.conditional_target:
if __condition_met(question.reveal_response, target, lst):
# the condition was met then the question is required.
# ... so check if it has a value
if not __has_value(question.key, lst):
complete = False
missing_responses += [question.key]
return complete, missing_responses


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

@ -827,7 +827,7 @@
},
{
"fields": {
"name": "Do you have a court order about parenting and support of the children?",
"name": "Do you have an order about support of the children?",
"description": "For Step 6, Your children - What are you asking for",
"summary_order": 0,
"required": "Required"
@ -1790,7 +1790,8 @@
"name": "What is the monthly child support amount (as per Schedule 1 of the guidelines) that is payable?",
"description": "For Step 6, Your children - Income & expenses",
"summary_order": 0,
"required": "Required"
"required": "Conditional",
"reveal_response": ""
},
"model": "core.question",
"pk": "payor_monthly_child_support_amount"


Loading…
Cancel
Save