From defe896422b4b03d20ce49c05f5ed68256cee0ee Mon Sep 17 00:00:00 2001 From: ariannedee Date: Mon, 24 Aug 2020 16:54:45 -0700 Subject: [PATCH] Split fact sheets into separate templates --- edivorce/apps/core/static/js/main.js | 55 -- .../partials/fact_sheets/fact_sheet_b.html | 237 +++++ .../partials/fact_sheets/fact_sheet_c.html | 147 +++ .../partials/fact_sheets/fact_sheet_d.html | 76 ++ .../partials/fact_sheets/fact_sheet_e.html | 313 +++++++ .../partials/fact_sheets/fact_sheet_f.html | 74 ++ .../{ => fact_sheets}/fact_sheet_f_table.html | 0 .../templates/question/06_children_facts.html | 836 +----------------- edivorce/apps/core/utils/derived.py | 31 +- .../apps/core/utils/question_step_mapping.py | 2 + edivorce/apps/core/utils/step_completeness.py | 2 +- 11 files changed, 888 insertions(+), 885 deletions(-) create mode 100644 edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_b.html create mode 100644 edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_c.html create mode 100644 edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_d.html create mode 100644 edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_e.html create mode 100644 edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_f.html rename edivorce/apps/core/templates/partials/{ => fact_sheets}/fact_sheet_f_table.html (100%) diff --git a/edivorce/apps/core/static/js/main.js b/edivorce/apps/core/static/js/main.js index 8d039b68..dfd05def 100755 --- a/edivorce/apps/core/static/js/main.js +++ b/edivorce/apps/core/static/js/main.js @@ -355,25 +355,6 @@ $(function () { } }); - // show fact sheet b - if (childWithBoth) { - $('#fact_sheet_b').show(); - } else { - $('#fact_sheet_b').hide(); - } - - // show fact sheet c - // When the claimants have indicated that they have more than one child, then show fact sheet c if each - // claimant has sole custody of at least one of the children or if one claimant has sole custody of at least one - // child and the both claimants have shared custody of the remaining children. - if (childWithYou && (childWithSpouse || childWithBoth)) { - $('#fact_sheet_c').show(); - } else if (childWithSpouse && (childWithYou || childWithBoth)) { - $('#fact_sheet_c').show(); - } else { - $('#fact_sheet_c').hide(); - } - // Initiate Child support payor. populateChildSupportPayor(childWithBoth, childWithYou, childWithSpouse); $('.determine-payor').on('change', function() { @@ -589,42 +570,6 @@ $(function () { }); var payorCallback = function() { - var claimant = $(this).val(); - - var toggleFactSheetTable = function(table_suffix, claimant_name_selector, hide) { - $('#fact_sheet_f').show(); - if (hide) { - $('#fact_sheet_f_table_' + table_suffix).hide(); - } else { - var fact_sheet_table_element = $('#fact_sheet_f_table_' + table_suffix); - fact_sheet_table_element.show(); - fact_sheet_table_element.find('input:radio, input:checkbox').each(reveal_input_elements); - } - - if (claimant_name_selector) { - $('#fact_sheet_f_payor_title_' + table_suffix).text($(claimant_name_selector).text()); - } - }; - - if (claimant === 'Myself (Claimant 1)' && parseFloat($('input[name="annual_gross_income"]').val()) > 150000) { - toggleFactSheetTable('1', '#__name_you'); - toggleFactSheetTable('2', null, true); - } else if (claimant === 'My Spouse (Claimant 2)' && parseFloat($('input[name="spouse_annual_gross_income"]').val()) > 150000) { - toggleFactSheetTable('2', '#__name_spouse'); - toggleFactSheetTable('1', null, true); - } else if (claimant === 'Both myself and my spouse') { - if (parseFloat($('input[name="annual_gross_income"]').val()) > 150000) { - toggleFactSheetTable('1', '#__name_you'); - } - if (parseFloat($('input[name="spouse_annual_gross_income"]').val()) > 150000) { - toggleFactSheetTable('2', '#__name_spouse'); - } - } else { - $('#fact_sheet_f').hide(); - $('#fact_sheet_f_table_1').hide(); - $('#fact_sheet_f_table_2').hide(); - } - // Update Factsheet B payor label var amount_b_you = $('#fact_b_your_child_support_paid').val(); var amount_b_spouse = $('#fact_b_your_spouse_child_support_paid').val(); diff --git a/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_b.html b/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_b.html new file mode 100644 index 00000000..1a13e9eb --- /dev/null +++ b/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_b.html @@ -0,0 +1,237 @@ +{% load input_field %} + +
+

Shared Living Arrangement (Fact Sheet B)

+

+ Since you have previously indicated that the child/children will live with both parents more or less equally + (between 40 to 60% of the time with each parent) we need you to answer the questions below, even if you have a Separation Agreement or + existing Court Order.
+ This information is needed for the Judge. You will be able to indicate a different child support amount in a following step. +

+
+

Number of children{% if number_of_children_error %}{% include 'partials/required.html' %}{% endif %}

+

+ This is the number of children for which you and your spouse have a shared parenting arrangement + (the child spends at least 40 percent of the time with each of you in a year). If you and your spouse + have a split parenting arrangement for any other children, do not include them in this set of questions. +

+ {% input_field type="number" name="number_of_children" class="form-control input-narrow positive-integer" min="0" %} +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
YouSpouse
+

+ What is the approximate amount of time the children spend with each parent? +

+

+ Note: This includes time that a parent is responsible for the children, even if they are not + physically with that parent (for example the child is at school). +

+ +
+
+

For more information please refer to:

+ +
+
+
+
+
+ {% input_field type="number" name="time_spent_with_you" class="fact-sheet-input" min="0" placeholder="enter number" ignore_error=True %} + +
+
+
+
+
+ {% input_field type="number" name="time_spent_with_spouse" class="fact-sheet-input" min="0" placeholder="enter number" ignore_error=True %} + +
+
+
Annual income as per + Federal Child Support + Guidelines + + + +
+ {% money_input_field id="fact_b_annual_gross_income" name="annual_gross_income" value="" class="fact-sheet-input" readonly="" ignore_error=True %} +
+
+
+ {% money_input_field id="fact_b_spouse_annual_gross_income" name="spouse_annual_gross_income" value="" class="fact-sheet-input" readonly="" ignore_error=True %} +
+
What is the 'Guideline' amount for child support? + +
+
+ {% money_input_field id="fact_b_your_child_support_paid" name="your_child_support_paid_b" class="fact-sheet-input claimants-child-support-amounts determine-payor" data_calc_delta="true" data_delta_term_selector=".claimants-child-support-amounts" data_delta_target_selector="input[name=difference_payment_amounts_b]" placeholder="enter amount" ignore_error=True %} +
+
+
+
+
+ {% money_input_field id="fact_b_your_spouse_child_support_paid" name="your_spouse_child_support_paid_b" class="fact-sheet-input claimants-child-support-amounts determine-payor" data_calc_delta="true" data_delta_term_selector=".claimants-child-support-amounts" data_delta_target_selector="input[name=difference_payment_amounts_b]" placeholder="enter amount" ignore_error=True %} +
+
+
+ +
+
+

+ To figure out how much child support the + + payor + will be paying under the guidelines: +

+ +

+ To speak to someone in person, you can call the Department of Justice Canada's Family + Law Information Line at 1-888-373-2222. When you call, be ready to tell them: +

+
    +
  • Where the paying parent lives
  • +
  • Whether both parents live in the same province or territory, and
  • +
  • The number of children to be supported
  • +
+
+
+
+ Difference between the Guidelines table amount of the claimant and the Guidelines table amount of the respondent + +
+ {% money_input_field name="difference_payment_amounts_b" value="" class="money fact-sheet-input" readonly="" %} +
+
+ Special or extraordinary expenses (as per + Section 7 of the Federal Child + Support Guidelines + + + ) to be paid monthly + +
+ {% money_input_field name="your_proportionate_share_amount" class="money fact-sheet-input" readonly="" %} +
+
+
+ {% money_input_field name="spouse_proportionate_share_amount" class="money fact-sheet-input" readonly="" %} +
+
+

+ Any other relevant information regarding the conditions, means, needs and other circumstances of + each spouse or of any child for whom support is sought? {% include 'partials/optional.html' %} +

+ {% input_field style="height:50px;" type="textarea" name="additional_relevant_spouse_children_info" maxlength="500" rows="3" class="fact-sheet-input form-control response-textarea" %} +
+

Amount of child support to be paid per month by payor

+

Please note: You will need to indicate who the 'payor' is below.

+
+
+ {% money_input_field name="difference_payment_amounts_b" value="" class="money fact-sheet-input different-payment-amounts" readonly="" %} +
+
+
diff --git a/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_c.html b/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_c.html new file mode 100644 index 00000000..c29c43e9 --- /dev/null +++ b/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_c.html @@ -0,0 +1,147 @@ +{% load input_field %} + +
+

Split Living Arrangement (Fact Sheet C)

+

+ Since you have previously indicated that you and your spouse have more than one child and + at least one of the children lives primarily with just 1 parent (more than 60% of the time) + you must complete Fact Sheet C. + This information is needed for the Judge. You will be able to indicate a different child support amount in a following step. +

+ {% if derived.show_fact_sheet_b and derived.show_fact_sheet_c %} +
+

+ Do not include any children that are SHARED on fact sheet B. You may indicate 0 (zero) children for 1 of the parents in Fact + Sheet C and insert 0 (zero) dollars for child support amount. +

+
+ {% endif %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ How many children spend more than 60 percent of their time with you and for whom you are asking for support? + +
+ {% input_field type="number" name="number_of_children_claimant" class="positive-integer fact-sheet-input number-spinner" min="0" placeholder="enter number" %} +
+
+

+ Your spouse's annual income? +

+ +

+ As per + {% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://laws-lois.justice.gc.ca/eng/regulations/SOR-97-175/page-2.html#h-6" link_text="sections 15 to 20" %} + of the Federal Child Support Guidelines +

+ +
+
+ The Federal Child Support Guidelines, Step-by-Step Guide has a + {% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://www.justice.gc.ca/eng/rp-pr/fl-lf/child-enfant/guide/w1-f1.html#s1" link_text="worksheet" %} + you can use to help calculate your annual income. Step-by-step instructions are also detailed in the + {% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://www.justice.gc.ca/eng/rp-pr/fl-lf/child-enfant/guide/step5-etap5.html#h7" link_text="Step-by-Step Guide" %} + . +
+
+
+
+ {% money_input_field id="fact_c_spouse_annual_gross_income" name="spouse_annual_gross_income" class="fact-sheet-input money" readonly="" %} +
+
+

What is the 'Guideline' amount for child support payable by your spouse (as per + {% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://laws-lois.justice.gc.ca/eng/regulations/SOR-97-175/page-11.html#h-15" link_text="Federal Child Support Tables" %} + )? +

+ {% include "partials/inline_question_determine_amount_to_pay.html" with collapse_target_id="collapse_calculate_amount_to_pay" %} +
+
+ {% money_input_field id="fact_c_your_spouse_child_support_paid" name="your_spouse_child_support_paid_c" class="fact-sheet-input money claimants-child-support-paid determine-payor" data_calc_delta="true" data_delta_term_selector=".claimants-child-support-paid" data_delta_target_selector="input[name=difference_payment_amounts_c]" ignore_error=True %} +
+
+ How many children spend more than 60 percent of their time with your spouse and for whom you are obliged to pay + support? + + {% input_field type="number" name="number_of_children_claimant_spouse" class="positive-integer fact-sheet-input number-spinner" min="0" placeholder="enter number" %} +
+

Your annual income?

+ +

+ As per + {% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://laws-lois.justice.gc.ca/eng/regulations/SOR-97-175/page-2.html#h-6" link_text="sections 15 to 20" %} + of the Federal Child Support Guidelines +

+ + +
+
+ The Federal Child Support Guidelines, Step-by-Step Guide has a + {% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://www.justice.gc.ca/eng/rp-pr/fl-lf/child-enfant/guide/w1-f1.html#s1" link_text="worksheet" %} + you can use to + help calculate your annual income. Step-by-step instructions are also detailed in the + {% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://www.justice.gc.ca/eng/rp-pr/fl-lf/child-enfant/guide/step5-etap5.html#h7" link_text="Step-by-Step Guide" %} + . +
+
+
+
+ {% money_input_field id="fact_c_annual_gross_income" name="annual_gross_income" class="fact-sheet-input money" readonly="" %} +
+
+

What is the 'Guideline' amount for child support payable by you (as per + {% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://laws-lois.justice.gc.ca/eng/regulations/SOR-97-175/page-11.html#h-15" link_text="Federal Child Support Tables" %} + )? +

+ + {% include "partials/inline_question_determine_amount_to_pay.html" with collapse_target_id="collapse_calculate_claimant_amounts" %} +
+
+ {% money_input_field id="fact_c_your_child_support_paid" name="your_child_support_paid_c" class="fact-sheet-input money claimants-child-support-paid determine-payor" data_calc_delta="true" data_delta_term_selector=".claimants-child-support-paid" data_delta_target_selector="input[name=difference_payment_amounts_c]" %} +
+
+ Difference between Guidelines table amounts + +
+ {% money_input_field id="difference_payment_amounts_c" name="difference_payment_amounts_c" class="fact-sheet-input different-payment-amounts" readonly="" %} +
+
+
diff --git a/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_d.html b/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_d.html new file mode 100644 index 00000000..9e56d508 --- /dev/null +++ b/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_d.html @@ -0,0 +1,76 @@ +{% load input_field %} +
+

Child(ren) 19 Years or Older (Fact Sheet D)

+

+ Since you have previously indicated that you have a child/children 19 years of age or older for whom support + is claimed, you will need to answer the next set of questions. +

+ +
+

+ How many child(ren) are 19 years or older for whom you are asking for support? +

+
+ {% input_field type="number" name="number_children_over_19_need_support" value="number_children_over_19" class="fact-sheet-input input-narrow positive-integer" readonly="" %} +
+
+ +
+

+ What would the child support amount be using the Federal Child Support Guidelines? + This information is needed for the Judge. You will be able to indicate a different child support amount in a following step. +

+
+ {% if derived.show_fact_sheet_b or derived.show_fact_sheet_c %} +
+ {% money_input_field id="total_spouse_paid_child_support" name="total_spouse_paid_child_support" value=derived.guideline_amounts_difference_total class="fact-sheet-input money input-narrow form-block response-textbox" readonly="" %} +
+ {% else %} +
+ {% money_input_field name="total_spouse_paid_child_support" value_src="payor_monthly_child_support_amount" class="fact-sheet-input money input-narrow form-block response-textbox" readonly="" %} +
+ {% endif %} +
+ {% include "partials/inline_question_determine_amount_to_pay.html" with collapse_target_id="collapse_calculate_amounts" %} +
+ +
+

+ Because you have a child(ren) 19 years or older, who may also be contributing to their own support, do you and your spouse agree that the + monthly Guidelines table amount for child support is appropriate? + {% if agree_to_guideline_child_support_amount_error %}{% include 'partials/required.html' %}{% endif %} +

+
+ + + +
+ +
+
diff --git a/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_e.html b/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_e.html new file mode 100644 index 00000000..ef29ab5f --- /dev/null +++ b/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_e.html @@ -0,0 +1,313 @@ +{% load input_field %} +
+

Are you or your spouse claiming undue hardship?{% if claiming_undue_hardship_error %}{% include 'partials/required.html' %}{% endif %}

+

+ The Child Support Guidelines tables contain the base amounts for child support. If you our your spouse feel + that the child support amount will not leave enough money, you can claim that you will suffer + + undue hardship. + +

+ +
+ + + +
+ + +
+
+

The types of situations that might result in undue hardship include:

+
    +
  • having an unusual or excessive amount of debt,
  • +
  • having to make other support payments to children of another family (for example, from a previous marriage),
  • +
  • having to support a disabled or ill person, and
  • +
  • having to spend a lot of money to visit the child (for example, airfare to another city).
  • +
+
+
+ +
diff --git a/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_f.html b/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_f.html new file mode 100644 index 00000000..e254623f --- /dev/null +++ b/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_f.html @@ -0,0 +1,74 @@ +
+

Income over $150,000 (Fact Sheet F)

+

+ Since you have previously indicated that the payor's income is over $150,000 you will need to provide + answers to the next set of questions. The child support guideline table you previously entered only goes + to $150,000. Income beyond that point requires a 2 stage calculation, the amount payable at $150,000 + + the amount payable on the income in excess of $150,000. This takes into account other factors such as + the financial ability of each parent, maintaining a certain quality of life, etc. It is no longer a + matter of there being money simply to look after the needs of the child, but rather the level of care + factoring in the family's lifestyle. +

+ +

+

+

+ +
+
+

+ If the paying parent earns more than $150,000 per year, you may need to calculate both incomes. + The Federal Guidelines provide two options: +

+
    +
  • + Option 1: You can use the tables to determine the child support amount for the first $150,000. Then add + the percentage listed in the tables for the portion of income over $150,000. If you choose this + option, you would only need to calculate the paying parent’s income. +
  • +
  • + Option 2: You can use the tables to determine the child support amount for the first $150,000. You can + then determine an amount for the portion of income over $150,000 by looking at the condition, + means, needs and other circumstances of the child and the financial ability of each of you to + contribute. If you choose this option, you would need to calculate both incomes. +
  • +
+

+ In some cases: +

+
    +
  • + You may need to calculate your child’s income—for example, if the child is over the age of + majority and you are taking his or her financial means into consideration to determine a + child support amount. +
  • +
  • + You may need to calculate the income of every member of both households to compare the + standards of living if either of you is claiming undue hardship. +
  • +
+

+ Source: The + {% include "partials/tooltip_link_federal_child_support_guidelines.html" with reference_link="http://www.justice.gc.ca/eng/rp-pr/fl-lf/child-enfant/guide/step5-etap5.html#h7" link_text="Federal Child Support Guidelines" %} + Department of Justice +

+ +
+
+ + {% if derived.show_fact_sheet_f_you %} +
+ {% include "partials/fact_sheets/fact_sheet_f_table.html" with table_id=1 claimant_id='you' %} +
+ {% endif %} + {% if derived.show_fact_sheet_f_spouse %} +
+ {% include "partials/fact_sheets/fact_sheet_f_table.html" with table_id=2 claimant_id='spouse' %} +
+ {% endif %} +
diff --git a/edivorce/apps/core/templates/partials/fact_sheet_f_table.html b/edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_f_table.html similarity index 100% rename from edivorce/apps/core/templates/partials/fact_sheet_f_table.html rename to edivorce/apps/core/templates/partials/fact_sheets/fact_sheet_f_table.html diff --git a/edivorce/apps/core/templates/question/06_children_facts.html b/edivorce/apps/core/templates/question/06_children_facts.html index 3332f6c3..882a7f31 100644 --- a/edivorce/apps/core/templates/question/06_children_facts.html +++ b/edivorce/apps/core/templates/question/06_children_facts.html @@ -14,374 +14,13 @@ - - - - + {% if derived.show_fact_sheet_c %} + {% include "partials/fact_sheets/fact_sheet_c.html" %} + {% endif %}
{% money_input_field name="annual_gross_income" hidden="true" %} @@ -476,466 +115,15 @@
+ {% if derived.show_fact_sheet_d %} + {% include "partials/fact_sheets/fact_sheet_d.html" %} + {% endif %} -{% if derived.show_fact_sheet_d %} -
-

Child(ren) 19 Years or Older (Fact Sheet D)

-

- Since you have previously indicated that you have a child/children 19 years of age or older for whom support - is claimed, you will need to answer the next set of questions. -

- -
-

- How many child(ren) are 19 years or older for whom you are asking for support? -

-
- {% input_field type="number" name="number_children_over_19_need_support" value="number_children_over_19" class="fact-sheet-input input-narrow positive-integer" readonly="" %} -
-
- -
-

- What would the child support amount be using the Federal Child Support Guidelines? - This information is needed for the Judge. You will be able to indicate a different child support amount in a following step. -

-
- {% if derived.show_fact_sheet_b or derived.show_fact_sheet_c %} -
- {% money_input_field id="total_spouse_paid_child_support" name="total_spouse_paid_child_support" value=derived.guideline_amounts_difference_total class="fact-sheet-input money input-narrow form-block response-textbox" readonly="" %} -
- {% else %} -
- {% money_input_field name="total_spouse_paid_child_support" value_src="payor_monthly_child_support_amount" class="fact-sheet-input money input-narrow form-block response-textbox" readonly="" %} -
- {% endif %} -
- {% include "partials/inline_question_determine_amount_to_pay.html" with collapse_target_id="collapse_calculate_amounts" %} -
- -
-

- Because you have a child(ren) 19 years or older, who may also be contributing to their own support, do you and your spouse agree that the monthly Guidelines table amount for child support is appropriate? - {% if agree_to_guideline_child_support_amount_error %}{% include 'partials/required.html' %}{% endif %} -

-
- - - -
- -
-
-{% endif %} - - - - -
-

Are you or your spouse claiming undue hardship?{% if claiming_undue_hardship_error %}{% include 'partials/required.html' %}{% endif %}

-

- The Child Support Guidelines tables contain the base amounts for child support. If you our your spouse feel - that the child support amount will not leave enough money, you can claim that you will suffer - - undue hardship. - -

- -
- - - -
- - -
-
-

The types of situations that might result in undue hardship include:

-
    -
  • having an unusual or excessive amount of debt,
  • -
  • having to make other support payments to children of another family (for example, from a previous marriage),
  • -
  • having to support a disabled or ill person, and
  • -
  • having to spend a lot of money to visit the child (for example, airfare to another city).
  • -
-
-
- -
+ {% if derived.show_fact_sheet_f %} + {% include "partials/fact_sheets/fact_sheet_f.html" %} + {% endif %} + {% include "partials/fact_sheets/fact_sheet_e.html" %} {% endblock %} diff --git a/edivorce/apps/core/utils/derived.py b/edivorce/apps/core/utils/derived.py index f34ecac6..3b137d0d 100644 --- a/edivorce/apps/core/utils/derived.py +++ b/edivorce/apps/core/utils/derived.py @@ -28,9 +28,12 @@ DERIVED_DATA = [ 'wants_other_orders', 'show_fact_sheet_a', 'show_fact_sheet_b', + 'fact_sheet_b_error', 'show_fact_sheet_c', 'show_fact_sheet_d', + 'fact_sheet_d_error', 'show_fact_sheet_e', + 'fact_sheet_e_error', 'show_fact_sheet_f_you', 'show_fact_sheet_f_spouse', 'show_fact_sheet_f', @@ -75,7 +78,6 @@ DERIVED_DATA = [ 'pursuant_parenting_arrangement', 'pursuant_child_support', 'sole_custody', - 'missing_undue_hardship_details', ] @@ -157,6 +159,19 @@ def show_fact_sheet_b(responses, derived): return conditional_logic.determine_shared_custody(responses) +def fact_sheet_b_error(responses, derived): + questions = ['number_of_children', + 'time_spent_with_you', + 'time_spent_with_spouse', + 'annual_gross_income', + 'spouse_annual_gross_income', + 'your_child_support_paid_b', + 'your_spouse_child_support_paid_b', + ] + if derived['show_fact_sheet_b']: + return _any_question_errors(responses, questions) + + def show_fact_sheet_c(responses, derived): """ If any child lives with one parent and there's another child who lives with @@ -173,6 +188,12 @@ def show_fact_sheet_d(responses, derived): return conditional_logic.determine_child_over_19_supported(responses) +def fact_sheet_d_error(responses, derived): + questions = ['agree_to_guideline_child_support_amount', 'appropriate_spouse_paid_child_support', 'suggested_child_support'] + if derived['show_fact_sheet_d']: + return _any_question_errors(responses, questions) + + def show_fact_sheet_e(responses, derived): """ If the claimant is claiming undue hardship, Fact Sheet E is indicated. @@ -181,6 +202,10 @@ def show_fact_sheet_e(responses, derived): return responses.get('claiming_undue_hardship', '') == 'YES' +def fact_sheet_e_error(responses, derived): + return conditional_logic.determine_missing_undue_hardship_reasons(responses) + + def show_fact_sheet_f_you(responses, derived): """ If claimant 1 (you) is a payor and makes over $150,000/year, show fact sheet F for claimant 1 @@ -726,10 +751,6 @@ def sole_custody(responses, derived): return conditional_logic.determine_sole_custody(responses) -def missing_undue_hardship_details(responses, derived): - return conditional_logic.determine_missing_undue_hardship_reasons(responses) - - def _any_question_errors(responses, questions): for field in questions: error_field_name = f'{field}_error' diff --git a/edivorce/apps/core/utils/question_step_mapping.py b/edivorce/apps/core/utils/question_step_mapping.py index 2d7b2b7f..09ba844f 100644 --- a/edivorce/apps/core/utils/question_step_mapping.py +++ b/edivorce/apps/core/utils/question_step_mapping.py @@ -119,6 +119,7 @@ question_step_mapping = { 'undue_hardship', 'income_others', 'total_income_others', + # Fact sheet B 'number_of_children', 'time_spent_with_you', 'time_spent_with_spouse', @@ -126,6 +127,7 @@ question_step_mapping = { 'spouse_annual_gross_income', 'your_child_support_paid_b', 'your_spouse_child_support_paid_b', + # Fact sheet C 'your_child_support_paid_c', 'your_spouse_child_support_paid_c', 'agree_to_guideline_child_support_amount', diff --git a/edivorce/apps/core/utils/step_completeness.py b/edivorce/apps/core/utils/step_completeness.py index 17cdddf6..07ef6cc7 100644 --- a/edivorce/apps/core/utils/step_completeness.py +++ b/edivorce/apps/core/utils/step_completeness.py @@ -85,6 +85,6 @@ def get_error_dict(step, missing_questions): """ responses_dict = {} question_step = page_step_mapping[step] - for question_dict in missing_questions.get(question_step): + for question_dict in missing_questions.get(question_step, []): responses_dict[question_dict['question_id'] + '_error'] = True return responses_dict