Browse Source

Merge branch 'feature'

pull/160/head
Charles Shin 8 years ago
parent
commit
e952ea77a2
11 changed files with 133 additions and 149 deletions
  1. +1
    -1
      edivorce/apps/core/static/js/ajax.js
  2. +7
    -3
      edivorce/apps/core/static/js/controllers.js
  3. +11
    -2
      edivorce/apps/core/static/js/main.js
  4. +0
    -20
      edivorce/apps/core/templates/pdf/form35.html
  5. +0
    -5
      edivorce/apps/core/templates/pdf/form36.html
  6. +18
    -54
      edivorce/apps/core/templates/pdf/form38.html
  7. +17
    -19
      edivorce/apps/core/templates/pdf/form38_we.html
  8. +3
    -25
      edivorce/apps/core/templates/pdf/form52.html
  9. +2
    -2
      edivorce/apps/core/templates/question/09_other_questions.html
  10. +49
    -1
      edivorce/apps/core/tests.py
  11. +25
    -17
      edivorce/apps/core/utils/user_response.py

+ 1
- 1
edivorce/apps/core/static/js/ajax.js View File

@ -8,7 +8,7 @@ var ajaxOnChange = function () {
var isValid = true; var isValid = true;
// Check if date is in valid format DD/MM/YYYY // Check if date is in valid format DD/MM/YYYY
if (el.is(".date-picker") || el.is(".date-pickers")){
if (el.is(".date-picker") || el.is(".date-pickers") || el.is(".date-picker-future")){
isValid = validateDate(el); isValid = validateDate(el);
} }


+ 7
- 3
edivorce/apps/core/static/js/controllers.js View File

@ -193,7 +193,8 @@ var validateDate = function(el){
return true; return true;
} }
if (isValidDate(el.val())) {
var isFuture = el.is('.date-picker-future');
if (isValidDate(el.val(), isFuture)) {
el.val(formatDate(stringToDate(el.val()))); el.val(formatDate(stringToDate(el.val())));
return true; return true;
} }
@ -206,7 +207,7 @@ var validateDate = function(el){
}; };
// validates that a string is a valid date // validates that a string is a valid date
var isValidDate = function(dateString) {
var isValidDate = function(dateString, isFuture) {
if (dateString.trim() == '') { if (dateString.trim() == '') {
return true; return true;
} }
@ -215,7 +216,10 @@ var isValidDate = function(dateString) {
if (!isNaN(dt)) { if (!isNaN(dt)) {
var today = new Date(); var today = new Date();
if (dt <= today && dt.getFullYear() > 1900) {
if (isFuture && dt >= today && dt.getFullYear() <= today.getFullYear() + 100) {
return true;
}
else if (!isFuture && dt <= today && dt.getFullYear() > 1900) {
return true; return true;
} }
} }


+ 11
- 2
edivorce/apps/core/static/js/main.js View File

@ -117,10 +117,19 @@ var deleteAddedField = function(e){
// Configuration for datepicker // Configuration for datepicker
var date_picker = function (selector, showOnFocus) { var date_picker = function (selector, showOnFocus) {
var startDate, endDate;
if($(selector).data("allow-future-date")){
startDate = "+1d";
endDate = "+100y";
}
else {
startDate = "-100y";
endDate = "0d";
}
$(selector).datepicker({ $(selector).datepicker({
format: "dd/mm/yyyy", format: "dd/mm/yyyy",
startDate: "-100y",
endDate: "0d",
startDate: startDate,
endDate: endDate,
autoclose: true, autoclose: true,
todayHighlight: true, todayHighlight: true,
immediateUpdates: true, immediateUpdates: true,


+ 0
- 20
edivorce/apps/core/templates/pdf/form35.html View File

@ -43,10 +43,6 @@
REQUISITION REQUISITION
</h2> </h2>
<p hidden>
<em>[Rule 21-1 of the Supreme Court Family Rules applies to all forms.]</em>
</p>
</p> </p>
<p> <p>
<strong>Filed by:</strong> <span class="form-entry not-complete">[<em>party(ies)</em>]</span> <strong>Filed by:</strong> <span class="form-entry not-complete">[<em>party(ies)</em>]</span>
@ -61,10 +57,6 @@
<strong>FILED WITH THIS REQUISITION ARE:</strong> <strong>FILED WITH THIS REQUISITION ARE:</strong>
</p> </p>
<p hidden>
[<em>Check all of the following boxes and file the following with this requisition.</em>]
</p>
{% check_list source=responses.form35_dummy_requisition value='option1' as dummy_option %} {% check_list source=responses.form35_dummy_requisition value='option1' as dummy_option %}
<p class="schIndent1"> <p class="schIndent1">
<i class="fa {% if dummy_option %} fa-check-square-o {% else %} fa-square-o {% endif %}" aria-hidden="true"></i> draft of the order sought; <i class="fa {% if dummy_option %} fa-check-square-o {% else %} fa-square-o {% endif %}" aria-hidden="true"></i> draft of the order sought;
@ -82,19 +74,11 @@
<i class="fa {% if dummy_option %} fa-check-square-o {% else %} fa-square-o {% endif %}" aria-hidden="true"></i> filing fee. <i class="fa {% if dummy_option %} fa-check-square-o {% else %} fa-square-o {% endif %}" aria-hidden="true"></i> filing fee.
</p> </p>
<p hidden>
[<em>Check the following box and file the following with this requisition unless a response to family claim or response to counterclaim has been filed or unless this case is a joint family law case within the meaning of Rule 2-2 of the Supreme Court Family Rules</em>.]
</p>
{% check_list source=responses.form35_dummy_additional value='option1' as dummy_option %} {% check_list source=responses.form35_dummy_additional value='option1' as dummy_option %}
<p class="schIndent1"> <p class="schIndent1">
<i class="fa {% if dummy_option %} fa-check-square-o {% else %} fa-square-o {% endif %}" aria-hidden="true"></i> proof of service of the notice of family claim or counterclaim, as the case may be. <i class="fa {% if dummy_option %} fa-check-square-o {% else %} fa-square-o {% endif %}" aria-hidden="true"></i> proof of service of the notice of family claim or counterclaim, as the case may be.
</p> </p>
<p hidden>
[<em>Check the following box and file the following document with this requisition if</em>
</p>
<p class="schIndent1"> <p class="schIndent1">
<em>(a) the family law case includes a claim for divorce and the notice of family claim, response to family claim, counterclaim or response to counterclaim identifies a child of the marriage within the meaning of the <em>Divorce Act</em> (Canada), <em>(a) the family law case includes a claim for divorce and the notice of family claim, response to family claim, counterclaim or response to counterclaim identifies a child of the marriage within the meaning of the <em>Divorce Act</em> (Canada),
or or
@ -108,10 +92,6 @@
<i class="fa {% if dummy_option %} fa-check-square-o {% else %} fa-square-o {% endif %}" aria-hidden="true"></i> Child Support Affidavit in Form F37. <i class="fa {% if dummy_option %} fa-check-square-o {% else %} fa-square-o {% endif %}" aria-hidden="true"></i> Child Support Affidavit in Form F37.
</p> </p>
<p hidden>
[<em>Check the following box and file the following document with this requisition if a divorce is sought.</em>]
</p>
{% check_list source=responses.form35_dummy_additional value='option3' as dummy_option %} {% check_list source=responses.form35_dummy_additional value='option3' as dummy_option %}
<p class="schIndent1"> <p class="schIndent1">
<i class="fa {% if dummy_option %} fa-check-square-o {% else %} fa-square-o {% endif %}" aria-hidden="true"></i> affidavit in Form F38. <i class="fa {% if dummy_option %} fa-check-square-o {% else %} fa-square-o {% endif %}" aria-hidden="true"></i> affidavit in Form F38.


+ 0
- 5
edivorce/apps/core/templates/pdf/form36.html View File

@ -45,11 +45,6 @@
<tbody> <tbody>
<tr> <tr>
<td colspan="2"> <td colspan="2">
<p hidden>
<em>[Rule 21-1 of the Supreme Court Family Rules applies to all forms.]</em>
</p>
<p> <p>
I CERTIFY the pleadings and proceedings in this family law case are in order <br />[<em>add the following if applicable:</em> except that <span class="form-entry not-complete">&nbsp;</span>]. I CERTIFY the pleadings and proceedings in this family law case are in order <br />[<em>add the following if applicable:</em> except that <span class="form-entry not-complete">&nbsp;</span>].
</p> </p>


+ 18
- 54
edivorce/apps/core/templates/pdf/form38.html View File

@ -43,26 +43,12 @@
<p> <p>
Claimant: {% include "partials/name_with_alias.html" with name=responses.name_you use_other_name=responses.any_other_name_you other_names=responses.other_name_you %} Claimant: {% include "partials/name_with_alias.html" with name=responses.name_you use_other_name=responses.any_other_name_you other_names=responses.other_name_you %}
</p> </p>
<p hidden>
Claimant 1 [<em>joint family law case</em>]:
</p>
<p> <p>
Respondent: {% include "partials/name_with_alias.html" with name=responses.name_spouse use_other_name=responses.any_other_name_spouse other_names=responses.other_name_spouse %} Respondent: {% include "partials/name_with_alias.html" with name=responses.name_spouse use_other_name=responses.any_other_name_spouse other_names=responses.other_name_spouse %}
</p> </p>
<p hidden>
Claimant 2 [<em>joint family law case</em>]:
</p>
<p class="text-center"> <p class="text-center">
<strong>AFFIDAVIT - DESK ORDER DIVORCE</strong> <strong>AFFIDAVIT - DESK ORDER DIVORCE</strong>
</p> </p>
<div hidden>
<p class="text-center">
<em>[Rule 21-1 of the Supreme Court Family Rules applies to all forms.]</em>
</p>
<p>
<em>[Complete the form in accordance with the instructions found in the bracketed italicized wording and then remove all bracketed italicized wording so that it does not appear in the form when the form is filed.]</em>
</p>
</div>
<p> <p>
I, {% if responses.name_you %}{{ responses.name_you }}{% else %}<span class="form-entry not-complete">[<em>name</em>]</span>{% endif %}, of I, {% if responses.name_you %}{{ responses.name_you }}{% else %}<span class="form-entry not-complete">[<em>name</em>]</span>{% endif %}, of
{% if responses.address_to_send_official_document_street_you and responses.address_to_send_official_document_city_you and responses.address_to_send_official_document_prov_you and responses.address_to_send_official_document_country_you and responses.address_to_send_official_document_postal_code_you %} {% if responses.address_to_send_official_document_street_you and responses.address_to_send_official_document_city_you and responses.address_to_send_official_document_prov_you and responses.address_to_send_official_document_country_you and responses.address_to_send_official_document_postal_code_you %}
@ -76,19 +62,10 @@
<p class="schIndent1"> <p class="schIndent1">
2 There is no possibility of reconciliation between my spouse and me. 2 There is no possibility of reconciliation between my spouse and me.
</p> </p>
<p hidden>
[<em>Select whichever one of the 2 following provisions is correct and remove the provision that has not been selected so that it does not appear in the form when the form is filed.</em>]
</p>
<p class="schIndent1"> <p class="schIndent1">
3 I believe that the facts set out in {% if responses.form38_dummy_facts == 'option1' %}the notice of family claim{% else %}the response to family claim and counterclaim{% endif %} are true. 3 I believe that the facts set out in {% if responses.form38_dummy_facts == 'option1' %}the notice of family claim{% else %}the response to family claim and counterclaim{% endif %} are true.
</p> </p>
<p hidden>
<em>[Select whichever one of the 2 following provisions is correct, provide any required information and remove the provision that has not been selected so that it does not appear in the form when the form is filed.]</em>
</p>
{% if responses.original_marriage_certificate == 'YES' %} {% if responses.original_marriage_certificate == 'YES' %}
<p class="schIndent1"> <p class="schIndent1">
4 The certificate of marriage or certified copy of the registration of marriage filed in this family law case fully and correctly describes the true particulars of the marriage. 4 The certificate of marriage or certified copy of the registration of marriage filed in this family law case fully and correctly describes the true particulars of the marriage.
@ -100,22 +77,17 @@
</p> </p>
{% endif %} {% endif %}
<p hidden>
<em>[Select whichever one of the 4 following provisions is correct, complete the selected provision and remove the provisions that have not been selected so that they do not appear in the form when the form is filed.]</em>
</p>
{% if responses.divorce_reason == 'live separate' %}
<p class="schIndent1">
5 <span hidden>[<em>Select this provision if the grounds for divorce are separation for more than one year.</em>]</span> I was living separate and apart from my spouse at the start of this family law case and I have lived separate and apart from my spouse since
{% if responses.separation_date %} {{ responses.separation_date }}{% else %} <span class="form-entry not-complete">[<em>dd/mmm/yyyy</em>]</span>{% endif %}, except:
{% multiple_values_to_list source=responses.reconciliation_period as periods %}
{% if periods != '[]' %}
{% for period in periods %}
{{ period }}
{% endfor %}
{% else %}<span class="form-entry not-complete">[<em>provide dates of any periods of attempted reconciliation</em>]</span>.{% endif %}
</p>
{% else %}
<p class="schIndent1">
5 I was living separate and apart from my spouse at the start of this family law case and I have lived separate and apart from my spouse since
{% if responses.separation_date %} {{ responses.separation_date }}{% else %} <span class="form-entry not-complete">[<em>dd/mmm/yyyy</em>]</span>{% endif %}, except:
{% multiple_values_to_list source=responses.reconciliation_period as periods %}
{% if periods != '[]' %}
{% for period in periods %}
{{ period }}
{% endfor %}
{% else %}<span class="form-entry not-complete">[<em>provide dates of any periods of attempted reconciliation</em>]</span>.{% endif %}
</p>
{% comment "This section is out of scope" %}
<p class="schIndent1"> <p class="schIndent1">
5 [<em>Select this provision if the grounds for divorce are adultery of a spouse and there has been an admission of adultery.</em>] My spouse has admitted to me that <span class="form-entry not-complete">[<em>he/she</em>]</span> committed the acts of adultery alleged in Schedule 5 [<em>Select this provision if the grounds for divorce are adultery of a spouse and there has been an admission of adultery.</em>] My spouse has admitted to me that <span class="form-entry not-complete">[<em>he/she</em>]</span> committed the acts of adultery alleged in Schedule
1 of the <span class="form-entry not-complete">[<em>notice of family claim/counterclaim</em>]</span> and 1 of the <span class="form-entry not-complete">[<em>notice of family claim/counterclaim</em>]</span> and
@ -141,20 +113,15 @@
<p class="schIndent1"> <p class="schIndent1">
5 [<em>Select this provision if the grounds for divorce are physical or mental cruelty of a spouse.</em>] My spouse has treated me with physical or mental cruelty since the date of the marriage as follows: <span class="form-entry not-complete">&nbsp;</span>[<em>provide details</em>]<span class="form-entry not-complete">&nbsp;</span> 5 [<em>Select this provision if the grounds for divorce are physical or mental cruelty of a spouse.</em>] My spouse has treated me with physical or mental cruelty since the date of the marriage as follows: <span class="form-entry not-complete">&nbsp;</span>[<em>provide details</em>]<span class="form-entry not-complete">&nbsp;</span>
</p> </p>
{% endif %}
{% endcomment %}
<p class="schIndent1"> <p class="schIndent1">
6 I am neither directly nor indirectly a party to an agreement or conspiracy for the purpose of subverting the administration of justice, or to any agreement, understanding or arrangement to fabricate or suppress evidence or to deceive the court. 6 I am neither directly nor indirectly a party to an agreement or conspiracy for the purpose of subverting the administration of justice, or to any agreement, understanding or arrangement to fabricate or suppress evidence or to deceive the court.
</p> </p>
<p hidden>
[<em>Select whichever one of the 2 following provisions is correct, provide any required information and remove the provision that has not been selected so that it does not appear in the form when the form is filed.</em>]
<p class="schIndent1">
7 There are no children of the marriage as defined by the <em>Divorce Act</em> (Canada).
</p> </p>
{% if responses.children_of_marriage == 'NO' %}
<p class="schIndent1">
7 There are no children of the marriage as defined by the <em>Divorce Act</em> (Canada).
</p>
{% else %}
{% comment "This section is out of scope" %}
<p class="schIndent1"> <p class="schIndent1">
7 There are children of the marriage as defined by the <em>Divorce Act</em> (Canada) and 7 There are children of the marriage as defined by the <em>Divorce Act</em> (Canada) and
</p> </p>
@ -167,18 +134,15 @@
<p class="schIndent2"> <p class="schIndent2">
(c) the following arrangements for parenting have been made: <span class="form-entry not-complete">&nbsp;</span>[<em>provide details</em>]<span class="form-entry not-complete">&nbsp;</span> . (c) the following arrangements for parenting have been made: <span class="form-entry not-complete">&nbsp;</span>[<em>provide details</em>]<span class="form-entry not-complete">&nbsp;</span> .
</p> </p>
{% endif %}
{% endcomment %}
<p hidden>
<em>[Select and complete the following provision if you are seeking a change of name for yourself. If you are not seeking a change of name for yourself, remove this provision so that it does not appear in the form when the form is filed.]</em>
</p>
{% if responses.form38_dummy_new_name %} {% if responses.form38_dummy_new_name %}
<p class="schIndent1"> <p class="schIndent1">
8 Pursuant to section 5 of the <em>Name Act</em>, I am seeking to change my name from {% if responses.name_you %}{{ responses.name_you }}{% else %}<span class="form-entry not-complete">&nbsp;</span>{% endif %} to {% if responses.form38_dummy_new_name %}{{ responses.form38_dummy_new_name }}{% else %}<span class="form-entry not-complete">&nbsp;</span>{% endif %}. This application for a name change relates only to myself. 8 Pursuant to section 5 of the <em>Name Act</em>, I am seeking to change my name from {% if responses.name_you %}{{ responses.name_you }}{% else %}<span class="form-entry not-complete">&nbsp;</span>{% endif %} to {% if responses.form38_dummy_new_name %}{{ responses.form38_dummy_new_name }}{% else %}<span class="form-entry not-complete">&nbsp;</span>{% endif %}. This application for a name change relates only to myself.
</p> </p>
{% endif %} {% endif %}
<div hidden>
{% comment "This section is out of scope" %}
<p> <p>
<em>[Select and complete the following provision if you are seeking a change of name for one or more minor children. If you are not seeking a change of name for one or more minor children, remove this provision so that it does not appear in the form when the form is filed. Renumber this provision as section 8 if you are seeking a change of name for one or more minor children and have not included a section 8 immediately before this provision.]</em> <em>[Select and complete the following provision if you are seeking a change of name for one or more minor children. If you are not seeking a change of name for one or more minor children, remove this provision so that it does not appear in the form when the form is filed. Renumber this provision as section 8 if you are seeking a change of name for one or more minor children and have not included a section 8 immediately before this provision.]</em>
</p> </p>
@ -190,7 +154,7 @@
<p class="schIndent2"> <p class="schIndent2">
from <span class="form-entry not-complete">&nbsp;</span> to: <span class="form-entry not-complete">&nbsp;</span> from <span class="form-entry not-complete">&nbsp;</span> to: <span class="form-entry not-complete">&nbsp;</span>
</p> </p>
</div>
{% endcomment %}
<table class="table table-bordered"> <table class="table table-bordered">
<tbody> <tbody>


+ 17
- 19
edivorce/apps/core/templates/pdf/form38_we.html View File

@ -87,18 +87,17 @@
</p> </p>
{% endif %} {% endif %}
{% if responses.divorce_reason == 'live separate' %}
<p class="schIndent1">
5 Claimant 1 and claimant 2 were living separate and apart from each other at the start of this family law case and claimant 1 and claimant 2 have lived separate and apart from each other since
{% if responses.separation_date %} {{ responses.separation_date }}{% else %} <span class="form-entry not-complete">[<em>dd/mmm/yyyy</em>]</span>{% endif %}, except:
{% multiple_values_to_list source=responses.reconciliation_period as periods %}
{% if periods != '[]' %}
{% for period in periods %}
{{ period }}
{% endfor %}
{% else %}<span class="form-entry not-complete">[<em>provide dates of any periods of attempted reconciliation</em>]</span>.{% endif %}
</p>
{% else %}
<p class="schIndent1">
5 Claimant 1 and claimant 2 were living separate and apart from each other at the start of this family law case and claimant 1 and claimant 2 have lived separate and apart from each other since
{% if responses.separation_date %} {{ responses.separation_date }}{% else %} <span class="form-entry not-complete">[<em>dd/mmm/yyyy</em>]</span>{% endif %}, except:
{% multiple_values_to_list source=responses.reconciliation_period as periods %}
{% if periods != '[]' %}
{% for period in periods %}
{{ period }}
{% endfor %}
{% else %}<span class="form-entry not-complete">[<em>provide dates of any periods of attempted reconciliation</em>]</span>.{% endif %}
</p>
{% comment "This section is out of scope" %}
<p class="schIndent1"> <p class="schIndent1">
5 [<em>Select this provision if the grounds for divorce are adultery of a spouse and there has been an admission of adultery.</em>] My spouse has admitted to me that <span class="form-entry not-complete">[<em>he/she</em>]</span> committed the acts of adultery alleged in Schedule 5 [<em>Select this provision if the grounds for divorce are adultery of a spouse and there has been an admission of adultery.</em>] My spouse has admitted to me that <span class="form-entry not-complete">[<em>he/she</em>]</span> committed the acts of adultery alleged in Schedule
1 of the <span class="form-entry not-complete">[<em>notice of family claim/counterclaim</em>]</span> and 1 of the <span class="form-entry not-complete">[<em>notice of family claim/counterclaim</em>]</span> and
@ -124,16 +123,15 @@
<p class="schIndent1"> <p class="schIndent1">
5 [<em>Select this provision if the grounds for divorce are physical or mental cruelty of a spouse.</em>] My spouse has treated me with physical or mental cruelty since the date of the marriage as follows: <span class="form-entry not-complete">&nbsp;</span>[<em>provide details</em>]<span class="form-entry not-complete">&nbsp;</span> 5 [<em>Select this provision if the grounds for divorce are physical or mental cruelty of a spouse.</em>] My spouse has treated me with physical or mental cruelty since the date of the marriage as follows: <span class="form-entry not-complete">&nbsp;</span>[<em>provide details</em>]<span class="form-entry not-complete">&nbsp;</span>
</p> </p>
{% endif %}
{% endcomment %}
<p class="schIndent1"> <p class="schIndent1">
6 We are neither directly nor indirectly a party to an agreement or conspiracy for the purpose of subverting the administration of justice, or to any agreement, understanding or arrangement to fabricate or suppress evidence or to deceive the court. 6 We are neither directly nor indirectly a party to an agreement or conspiracy for the purpose of subverting the administration of justice, or to any agreement, understanding or arrangement to fabricate or suppress evidence or to deceive the court.
</p> </p>
{% if responses.children_of_marriage == 'NO' %}
<p class="schIndent1">
7 There are no children of the marriage as defined by the <em>Divorce Act</em> (Canada).
</p>
{% else %}
<p class="schIndent1">
7 There are no children of the marriage as defined by the <em>Divorce Act</em> (Canada).
</p>
{% comment "This section is out of scope" %}
<p class="schIndent1"> <p class="schIndent1">
7 There are children of the marriage as defined by the <em>Divorce Act</em> (Canada) and 7 There are children of the marriage as defined by the <em>Divorce Act</em> (Canada) and
</p> </p>
@ -146,7 +144,7 @@
<p class="schIndent2"> <p class="schIndent2">
(c) the following arrangements for parenting have been made: <span class="form-entry not-complete">&nbsp;</span>[<em>provide details</em>]<span class="form-entry not-complete">&nbsp;</span> . (c) the following arrangements for parenting have been made: <span class="form-entry not-complete">&nbsp;</span>[<em>provide details</em>]<span class="form-entry not-complete">&nbsp;</span> .
</p> </p>
{% endif %}
{% endcomment %}
<!-- TODO Confirm how to ask and decide his/her --> <!-- TODO Confirm how to ask and decide his/her -->
{% if responses.form38_dummy_new_name %} {% if responses.form38_dummy_new_name %}


+ 3
- 25
edivorce/apps/core/templates/pdf/form52.html View File

@ -41,17 +41,6 @@
FINAL ORDER FINAL ORDER
</h2> </h2>
<div hidden>
<p>
<em>[Rule 21-1 of the Supreme Court Family Rules applies to all forms.]</em>
</p>
</p>
<p>
<em>[Complete the form in accordance with the instructions found in the bracketed italicized wording and then remove all bracketed italicized wording so that it does not appear in the form when the form is filed.]</em>
</p>
</div>
<table class="table table-bordered"> <table class="table table-bordered">
<tbody> <tbody>
<tr> <tr>
@ -64,8 +53,8 @@
</tbody> </tbody>
</table> </table>
<!-- Not in use -->
<div hidden>
{% comment "This section is out of scope" %}
<div>
<p> <p>
<em>[Select whichever one of the 4 following provisions is correct, provide any required information and remove the provisions that have not been selected so that they do not appear in the form when the form is filed.]</em> <em>[Select whichever one of the 4 following provisions is correct, provide any required information and remove the provisions that have not been selected so that they do not appear in the form when the form is filed.]</em>
</p> </p>
@ -82,6 +71,7 @@
and on considering the evidence put forward; and on considering the evidence put forward;
</p> </p>
</div> </div>
{% endcomment %}
<p class="schIndent1"> <p class="schIndent1">
This family law case coming on as an undefended family law case without an oral hearing under Rule 10-10 of the Supreme Court Family Rules, and on considering the evidence put forward; This family law case coming on as an undefended family law case without an oral hearing under Rule 10-10 of the Supreme Court Family Rules, and on considering the evidence put forward;
@ -90,10 +80,6 @@
THIS COURT ORDERS that THIS COURT ORDERS that
</p> </p>
<p hidden>
<em>[If a divorce is granted, select whichever one of the 2 following provisions is correct, complete the selected provision and remove the provision that has not been selected so that it does not appear in the form when the form is filed. If a divorce is not granted, remove both of the following provisions so that they do not appear in the form when the form is filed.]</em>
</p>
<p class="schIndent1"> <p class="schIndent1">
Subject to section 12 of the <em>Divorce Act</em> (Canada), the claimant, {% if responses.name_you %}{{name_you}}{% else %}<span class="form-entry not-complete">[<em>name</em>]</span>{% endif %}, and the respondent, {% if responses.name_spouse %}{{ name_spouse }}{% else %}<span class="form-entry not-complete">[<em>name</em>]</span>{% endif %}, who were married at Subject to section 12 of the <em>Divorce Act</em> (Canada), the claimant, {% if responses.name_you %}{{name_you}}{% else %}<span class="form-entry not-complete">[<em>name</em>]</span>{% endif %}, and the respondent, {% if responses.name_spouse %}{{ name_spouse }}{% else %}<span class="form-entry not-complete">[<em>name</em>]</span>{% endif %}, who were married at
{% if responses.where_were_you_married_city and responses.where_were_you_married_prov and responses.where_were_you_married_country %} {% if responses.where_were_you_married_city and responses.where_were_you_married_prov and responses.where_were_you_married_country %}
@ -112,10 +98,6 @@
THIS COURT ORDERS that BY CONSENT: THIS COURT ORDERS that BY CONSENT:
</p> </p>
<p hidden>
<em>[If orders other than or in addition to divorce orders are made, set out, in numbered paragraphs, the terms of all orders other than divorce orders.] [If any of the following orders are by consent, indicate that fact by adding the words "By consent," to the beginning of the description of the order.] [For each order, if any, made for custody, parenting arrangements, child support or spousal support, indicate whether the order is made under the Divorce Act or the Family Law Act.] [If no orders other than divorce orders are made, remove this provision so that it does not appear in the form when the form is filed.] </em>
</p>
<p class="schIndent1"> <p class="schIndent1">
1 <span class="form-entry not-complete">&nbsp;</span> 1 <span class="form-entry not-complete">&nbsp;</span>
</p> </p>
@ -129,10 +111,6 @@
THE FOLLOWING PARTIES APPROVE THE FORM OF THIS ORDER AND CONSENT TO EACH OF THE ORDERS, IF ANY, THAT ARE INDICATED ABOVE AS BEING BY CONSENT: THE FOLLOWING PARTIES APPROVE THE FORM OF THIS ORDER AND CONSENT TO EACH OF THE ORDERS, IF ANY, THAT ARE INDICATED ABOVE AS BEING BY CONSENT:
</p> </p>
<p hidden>
<em>[A signature line in the following form must be completed and signed by or for each approving party.]</em>
</p>
<table class="table table-bordered"> <table class="table table-bordered">
<tr> <tr>
<td> <td>


+ 2
- 2
edivorce/apps/core/templates/question/09_other_questions.html View File

@ -86,8 +86,8 @@
<h2>Divorce is to take effect on:</h2> <h2>Divorce is to take effect on:</h2>
<div class="radio"><label>{% input_field type="radio" class="radio-with-other" name="divorce_take_effect_on" value="the 31st day after" %}the 31st day after the date of this order</label></div> <div class="radio"><label>{% input_field type="radio" class="radio-with-other" name="divorce_take_effect_on" value="the 31st day after" %}the 31st day after the date of this order</label></div>
<div class="radio"><label>{% input_field type="radio" class="radio-with-other" name="divorce_take_effect_on" value="specific date" %}a specific date <div class="radio"><label>{% input_field type="radio" class="radio-with-other" name="divorce_take_effect_on" value="specific date" %}a specific date
<span class="input-group date date-picker-group">
{% input_field type="text" name="divorce_take_effect_on_specific_date" id="effect_date" class="date-picker other-textbox input-inline form-control" tabindex="-1" placeholder="DD/MM/YYYY" %}
<span class="input-group date date-picker-group" data-allow-future-date="true">
{% input_field type="text" name="divorce_take_effect_on_specific_date" id="effect_date" class="date-picker-future other-textbox input-inline form-control" tabindex="-1" placeholder="DD/MM/YYYY" %}
<span class="input-group-addon" > <span class="input-group-addon" >
<i class="fa fa-calendar circle"></i> <i class="fa fa-calendar circle"></i>
</span> </span>


+ 49
- 1
edivorce/apps/core/tests.py View File

@ -27,6 +27,12 @@ class UserResponseTestCase(TestCase):
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value') lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), True) self.assertEqual(is_complete(step, lst), True)
# Put empty response
UserResponse.objects.filter(question_id='want_which_orders').update(value="[]")
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), False)
def test_your_info(self): def test_your_info(self):
step = 'your_information' step = 'your_information'
questions = question_step_mapping[step] questions = question_step_mapping[step]
@ -82,11 +88,17 @@ class UserResponseTestCase(TestCase):
self.assertEqual(is_complete(step, lst), False) self.assertEqual(is_complete(step, lst), False)
# All required questions with all checking question with all hidden questions # All required questions with all checking question with all hidden questions
create_response(user, 'other_name_you', 'Smith')
create_response(user, 'other_name_you', '[["also known as","Smith"]]')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value') lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), True) self.assertEqual(is_complete(step, lst), True)
# Put empty response
UserResponse.objects.filter(question_id='other_name_you').update(value='[["also known as",""]]')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), False)
def test_your_spouse(self): def test_your_spouse(self):
step = 'your_spouse' step = 'your_spouse'
questions = question_step_mapping[step] questions = question_step_mapping[step]
@ -147,6 +159,12 @@ class UserResponseTestCase(TestCase):
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value') lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), True) self.assertEqual(is_complete(step, lst), True)
# Put empty response
UserResponse.objects.filter(question_id='name_spouse').update(value="")
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), False)
def test_your_marriage(self): def test_your_marriage(self):
pass pass
@ -165,6 +183,12 @@ class UserResponseTestCase(TestCase):
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value') lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), True) self.assertEqual(is_complete(step, lst), True)
# Put empty response
UserResponse.objects.filter(question_id='no_reconciliation_possible').update(value="")
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), False)
def test_spousal_support(self): def test_spousal_support(self):
step = 'spousal_support' step = 'spousal_support'
questions = question_step_mapping[step] questions = question_step_mapping[step]
@ -192,6 +216,12 @@ class UserResponseTestCase(TestCase):
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value') lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), False) self.assertEqual(is_complete(step, lst), False)
# Put empty response
UserResponse.objects.filter(question_id='spouse_support_details').update(value="")
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), False)
def test_property_and_debt(self): def test_property_and_debt(self):
step = 'property_and_debt' step = 'property_and_debt'
questions = question_step_mapping[step] questions = question_step_mapping[step]
@ -219,6 +249,12 @@ class UserResponseTestCase(TestCase):
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value') lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), True) self.assertEqual(is_complete(step, lst), True)
# Put empty response
UserResponse.objects.filter(question_id='how_to_divide_property_debt').update(value="")
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), False)
def test_other_orders(self): def test_other_orders(self):
step = 'other_orders' step = 'other_orders'
questions = question_step_mapping[step] questions = question_step_mapping[step]
@ -234,6 +270,12 @@ class UserResponseTestCase(TestCase):
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value') lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), True) self.assertEqual(is_complete(step, lst), True)
# Put empty response
UserResponse.objects.filter(question_id='other_orders_detail').update(value="")
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), False)
def test_other_questions(self): def test_other_questions(self):
pass pass
@ -252,6 +294,12 @@ class UserResponseTestCase(TestCase):
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value') lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), True) self.assertEqual(is_complete(step, lst), True)
# Put empty response
UserResponse.objects.filter(question_id='court_registry_for_filing').update(value="")
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), False)
# Helper functions # Helper functions
def create_response(user, question, value): def create_response(user, question, value):

+ 25
- 17
edivorce/apps/core/utils/user_response.py View File

@ -1,7 +1,7 @@
from edivorce.apps.core.models import UserResponse, Question from edivorce.apps.core.models import UserResponse, Question
from edivorce.apps.core.utils.question_step_mapping import question_step_mapping, complete_state_for_step from edivorce.apps.core.utils.question_step_mapping import question_step_mapping, complete_state_for_step
from copy import deepcopy from copy import deepcopy
import json
def get_responses_from_db(bceid_user): def get_responses_from_db(bceid_user):
responses = UserResponse.objects.filter(bceid_user=bceid_user) responses = UserResponse.objects.filter(bceid_user=bceid_user)
@ -82,22 +82,30 @@ def is_complete(step, lst):
for question in lst: for question in lst:
q_id = question['question_id'] q_id = question['question_id']
if q_id in required_list:
required_list.remove(q_id)
elif q_id in conditional_list:
value = question['value']
if q_id in conditional_list and value == conditional_list[q_id][0]:
key_in_list = False
for key in lst:
if key['question_id'] == conditional_list[q_id][1]:
key_in_list = True
break
if key_in_list is False:
return False
conditional_list.pop(q_id, None)
else:
conditional_list.pop(q_id, None)
value = question['value']
if value != '[]' and value != '':
if q_id in required_list:
required_list.remove(q_id)
elif q_id in conditional_list:
if q_id in conditional_list and value == conditional_list[q_id][0]:
key_in_list = False
hidden_q_id = conditional_list[q_id][1]
for key in lst:
if key['question_id'] == hidden_q_id:
# print("H: %s, V: %s|" %(hidden_q_id, key['value']))
if hidden_q_id == 'other_name_you' and not json.loads(key['value'])[0][1]:
break
elif not key['value']:
break
else:
key_in_list = True
break
if key_in_list is False:
return False
conditional_list.pop(q_id, None)
else:
conditional_list.pop(q_id, None)
if not required_list and not conditional_list: if not required_list and not conditional_list:
return True return True
return False return False

Loading…
Cancel
Save