Browse Source

Updated review page with new response formats

pull/160/head
Charles Shin 8 years ago
parent
commit
6fc06d9592
18 changed files with 694 additions and 149 deletions
  1. +24
    -0
      edivorce/apps/core/migrations/0011_auto_20170321_2201.py
  2. +19
    -0
      edivorce/apps/core/migrations/0012_auto_20170321_2237.py
  3. +29
    -0
      edivorce/apps/core/migrations/0013_auto_20170322_2055.py
  4. +8
    -0
      edivorce/apps/core/models.py
  5. +1
    -1
      edivorce/apps/core/static/js/controllers.js
  6. +1
    -1
      edivorce/apps/core/templates/overview.html
  7. +20
    -0
      edivorce/apps/core/templates/partials/review/orders.html
  8. +19
    -7
      edivorce/apps/core/templates/partials/review_user_responses.html
  9. +1
    -1
      edivorce/apps/core/templates/pdf/form1.html
  10. +1
    -1
      edivorce/apps/core/templates/prequalification/step_04.html
  11. +0
    -1
      edivorce/apps/core/templates/question/01_orders.html
  12. +6
    -6
      edivorce/apps/core/templates/question/11_review.html
  13. +362
    -0
      edivorce/apps/core/templatetags/summary_format.py
  14. +47
    -48
      edivorce/apps/core/tests.py
  15. +13
    -10
      edivorce/apps/core/utils/question_step_mapping.py
  16. +29
    -29
      edivorce/apps/core/utils/user_response.py
  17. +6
    -3
      edivorce/apps/core/views/main.py
  18. +108
    -41
      edivorce/fixtures/Question.json

+ 24
- 0
edivorce/apps/core/migrations/0011_auto_20170321_2201.py View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0010_auto_20170228_2038'),
]
operations = [
migrations.AlterModelOptions(
name='question',
options={'ordering': ('summary_order',)},
),
migrations.AddField(
model_name='question',
name='summary_order',
field=models.IntegerField(default=1),
preserve_default=False,
),
]

+ 19
- 0
edivorce/apps/core/migrations/0012_auto_20170321_2237.py View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0011_auto_20170321_2201'),
]
operations = [
migrations.AlterField(
model_name='question',
name='summary_order',
field=models.PositiveIntegerField(default=0),
),
]

+ 29
- 0
edivorce/apps/core/migrations/0013_auto_20170322_2055.py View File

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0012_auto_20170321_2237'),
]
operations = [
migrations.AddField(
model_name='question',
name='conditional_target',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='question',
name='required',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='question',
name='reveal_response',
field=models.TextField(blank=True),
),
]

+ 8
- 0
edivorce/apps/core/models.py View File

@ -46,6 +46,14 @@ class Question(models.Model):
summary_order = models.PositiveIntegerField(default=0)
""" Convenience for listing these in the admin """
required = models.TextField(blank=True)
conditional_target = models.TextField(blank=True)
reveal_response = models.TextField(blank=True)
class Meta:
ordering = ('summary_order', )


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

@ -116,7 +116,7 @@ var getValue = function(el, question){
else if (question == "other_name_you" || question == "other_name_spouse"){
var aliasType;
$('#other_names_fields').find("input[type=text]").each(function () {
aliasType = $(this).siblings(".alias-type").val();
aliasType = $(this).val() == '' ? '' : $(this).siblings(".alias-type").val();
value.push([aliasType, $(this).val()]);
});
return JSON.stringify(value);


+ 1
- 1
edivorce/apps/core/templates/overview.html View File

@ -48,7 +48,7 @@
</a>
{% if 'Spousal support' in which_orders.0.value|load_json %}
<a href="{% url 'question_steps' 'support' %}" class="progress-question {% if active_page == 'support' %} active {% endif %}">
<a href="{% url 'question_steps' 'support' %}" class="progress-question {% if step_status.spousal_support == 'Complete' %} complete {% endif %}">
<span class="progress-icon"><i class="fa fa-life-ring" aria-hidden="true"></i></span>
<span class="progress-content"><small>Step 6</small><br />Spousal support</span>
{% if step_status.spousal_support == 'Started' %}<span class="progress-status"><i class="fa fa-adjust" aria-hidden="true"></i> Started</span>


+ 20
- 0
edivorce/apps/core/templates/partials/review/orders.html View File

@ -0,0 +1,20 @@
{% load input_field %}
{% if questions %}
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Question</th>
<th>Response</th>
</tr>
</thead>
<tbody>
{% for question in questions %}
<tr>
<td width="75%" style="padding-right: 5%">{{question.question__name}} {{question.question__key}}</td>
<td width="25%">{% strip_value source=question.value question_key=question.question__key %}</td>
<td>{{question.value}}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}

+ 19
- 7
edivorce/apps/core/templates/partials/review_user_responses.html View File

@ -1,3 +1,4 @@
{% load summary_format %}
{% if questions %}
<table class="table table-bordered table-striped">
<thead>
@ -7,13 +8,24 @@
</tr>
</thead>
<tbody>
{% for question in questions %}
{{question.question}}
<tr>
<td width="75%" style="padding-right: 5%">{{question.question__name}}</td>
<td width="25%">{{question.value}}</td>
</tr>
{% endfor %}
{% if step == 'prequalification' %}
{% prequal_tag source=questions %}
{% elif step == 'your_information' or step == 'your_spouse' %}
{% personal_info_tag source=questions %}
{% elif step == 'property_and_debt' %}
{% property_tag source=questions %}
{% elif step == 'your_marriage' %}
{% marriage_tag source=questions %}
{% elif step == 'other_questions' %}
{% combine_address source=questions %}
{% else %}
{% for question in questions %}
<tr>
<td width="75%" style="padding-right: 5%">{{question.question__name}}</td>
<td width="25%">{% reformat_value source=question.value question_key=question.question_id %}</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
{% endif %}

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

@ -227,7 +227,7 @@
<td> <strong> Children: </strong> [<em>Check whichever one of the following boxes is correct and complete any required information.</em>] </td>
</tr>
<tr>
{% check_list source=responses.children_financial_support value='No' as children_of_marriage %}
{% check_list source=responses.children_financial_support value='NO' as children_of_marriage %}
<td><i class="fa {% if responses.children_of_marriage == 'NO' or children_of_marriage%} fa-check-square-o" aria-hidden="true"></i>{% else %} fa-square-o" aria-hidden="true"></i> {% endif %} There are no children of the marriage, as defined by the <em> Divorce Act </em> (Canada), or children of whom Claimant 1 and Claimant 2 are parents within the meaning of the <em> Family Law Act </em> . </td>
</tr>
<tr>


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

@ -59,7 +59,7 @@
<h3>Are you financially supporting any of the children that are 19 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_target_id="need_support" 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="NO" data_target_id="need_support" 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_target_id="need_support" data_reveal_target="true" data_target_class="not-disqualified-other" data_reveal_class="false" %}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_target_id="need_support" data_reveal_target="true" data_target_class="not-disqualified-other" data_reveal_class="false" %}Yes, due to disability</label></div>
<div class="checkbox"><label>{% input_field type="checkbox" name="children_financial_support" value="Yes, due to illness" data_target_id="need_support" data_reveal_target="true" data_target_class="not-disqualified-other" data_reveal_class="false" %}Yes, due to illness</label></div>


+ 0
- 1
edivorce/apps/core/templates/question/01_orders.html View File

@ -128,7 +128,6 @@
{% endblock %} {% block formBack %}{% url 'overview' %}{% endblock %} {% block formNext %}{% next_step step='orders' %}{% endblock %}{% block nextButtonAttribute %}id="check_order_selected" data-proceed="false" data-show_alert="false"{% endblock %}
{% block sidebarText %}
<h3>What are Orders?</h3>
<p>An order is the record of the judge's decision. It is filed at the court registry.</p>
<p>
An order is the record of the judge's decision. It is filed at the court registry. In Supreme Court, the parties involved in a case (or their lawyers) are responsible for telling the court the order(s) they want.
This is done by putting the details in writing in their


+ 6
- 6
edivorce/apps/core/templates/question/11_review.html View File

@ -18,7 +18,7 @@
</div>
<div class="collapse in" id="review_step_prequal">
<div>
{% include "partials/review_user_responses.html" with questions=prequalification %}
{% include "partials/review_user_responses.html" with questions=prequalification step='prequalification' %}
</div>
</div>
</div>
@ -44,7 +44,7 @@
</div>
<div class="collapse in" id="review_step_2">
<div>
{% include "partials/review_user_responses.html" with questions=your_information %}
{% include "partials/review_user_responses.html" with questions=your_information step='your_information' %}
</div>
</div>
</div>
@ -57,7 +57,7 @@
</div>
<div class="collapse in" id="review_step_3">
<div>
{% include "partials/review_user_responses.html" with questions=your_spouse %}
{% include "partials/review_user_responses.html" with questions=your_spouse step='your_spouse' %}
</div>
</div>
</div>
@ -70,7 +70,7 @@
</div>
<div class="collapse in" id="review_step_4">
<div>
{% include "partials/review_user_responses.html" with questions=your_marriage %}
{% include "partials/review_user_responses.html" with questions=your_marriage step='your_marriage' %}
</div>
</div>
</div>
@ -112,7 +112,7 @@
</div>
<div class="collapse in" id="review_step_7">
<div>
{% include "partials/review_user_responses.html" with questions=property_and_debt %}
{% include "partials/review_user_responses.html" with questions=property_and_debt step='property_and_debt' %}
</div>
</div>
</div>
@ -141,7 +141,7 @@
</div>
<div class="collapse in" id="review_step_9">
<div>
{% include "partials/review_user_responses.html" with questions=other_questions %}
{% include "partials/review_user_responses.html" with questions=other_questions step="other_questions" %}
</div>
</div>
</div>


+ 362
- 0
edivorce/apps/core/templatetags/summary_format.py View File

@ -0,0 +1,362 @@
from django import template
import json
register = template.Library()
@register.simple_tag
def reformat_value(source, question_key):
"""
Reformat user response on summary page
ie) Remove [], make it a bullet point form
"""
try:
lst = json.loads(source)
if len(lst) == 1:
return lst[0]
else:
return process_list(lst, question_key)
except:
if question_key == 'spouse_support_details' or question_key == 'other_orders_detail'\
or question_key == 'provide_certificate_later_reason' or question_key == 'not_provide_certificate_reason':
text_list = source.split('\n')
tag = ["<ul>"]
for value in text_list:
tag.append('<li>' + value + '</li>')
tag.append('</ul>')
return ''.join(tag)
return source
def process_list(lst, question_key):
tag = ["<ul>"]
if question_key.startswith('other_name_'):
for alias_type, value in lst:
if value != '':
tag.append('<li>' + alias_type + ' ' + value + '</li>')
else:
for value in lst:
tag.append('<li>' + value + '</li>')
tag.append('</ul>')
return ''.join(tag)
@register.simple_tag
def combine_address(source):
"""
Reformat address to combine them into one cell with multiple line
Also show/hide optional questions
"""
tags = []
first_column = '<tr><td width="75%" style="padding-right: 5%">'
second_column = '<td width="25%">'
end_tag = '</td></tr>'
address_you = ""
fax_you = ""
email_you = ""
address_spouse = ""
fax_spouse = ""
email_spouse = ""
is_specific_date = False
effective_date = ""
for item in source:
q_id = item['question_id']
if "you" in q_id:
if "email" not in q_id and "fax" not in q_id:
if q_id == "address_to_send_official_document_country_you":
continue
address_you += item["value"] + '<br />'
elif "fax" in q_id:
fax_you = item["value"]
elif "email" in q_id:
email_you = item["value"]
elif "spouse" in q_id:
if "email" not in q_id and "fax" not in q_id:
if q_id == "address_to_send_official_document_country_spouse":
continue
address_spouse += item["value"] + '<br />'
elif "fax" in q_id:
fax_spouse = item["value"]
elif "email" in q_id:
email_spouse = item["value"]
elif q_id == "divorce_take_effect_on":
if item['value'] == "specific date":
is_specific_date = True
else:
effective_date = item['value']
elif q_id == "divorce_take_effect_on_specific_date" and is_specific_date:
effective_date = item['value']
if address_you != "":
tags.append(first_column + "What is the best address to send you official court documents?</td>"
+ second_column + address_you + end_tag)
if fax_you != "":
tags.append(first_column + "Fax</td>" + second_column + fax_you + end_tag)
if email_you != "":
tags.append(first_column + "Email</td>" + second_column + email_you + end_tag)
if address_spouse != "":
tags.append(first_column + "What is the best address to send your spouse official court documents?</td>"
+ second_column + address_spouse + end_tag)
if fax_spouse != "":
tags.append(first_column + "Fax</td>" + second_column + fax_spouse + end_tag)
if email_spouse != "":
tags.append(first_column + "Email</td>" + second_column + email_spouse + end_tag)
if effective_date != "":
tags.append(first_column + "Divorce is to take effect on </td>" + second_column + effective_date + end_tag)
return ''.join(tags)
@register.simple_tag
def marriage_tag(source):
"""
Reformat your_marriage step
Also show/hide optional questions
"""
show_all = False
tags = []
first_column = '<tr><td width="75%" style="padding-right: 5%">'
second_column = '</td><td width="25%">'
end_tag = '</td></tr>'
marriage_location = ""
married_date = ""
married_date_q = ""
common_law_date = ""
common_law_date_q = ""
marital_status_you = ""
marital_status_you_q = ""
marital_status_spouse = ""
marital_status_spouse_q = ""
for item in source:
q_id = item['question_id']
value = item['value']
q_name = item['question__name']
if q_id == 'married_marriage_like' and value == 'Legally married':
show_all = True
elif q_id == 'when_were_you_married':
married_date_q = q_name
married_date = value
elif q_id == 'when_were_you_live_married_like':
common_law_date_q = q_name
common_law_date = value
elif q_id.startswith('where_were_you_married'):
if value == 'Other':
continue
marriage_location += value + '<br />'
elif q_id == 'marital_status_before_you':
marital_status_you_q = q_name
marital_status_you = value
elif q_id == 'marital_status_before_spouse':
marital_status_spouse_q = q_name
marital_status_spouse = value
if show_all and married_date != "":
tags.append(first_column + married_date_q + second_column + married_date + end_tag)
if common_law_date != "":
tags.append(first_column + common_law_date_q + second_column + common_law_date + end_tag)
if show_all and marriage_location != "":
tags.append(first_column + "Where were you married" + second_column + marriage_location + end_tag)
if marital_status_you != "":
tags.append(first_column + marital_status_you_q + second_column + marital_status_you + end_tag)
if marital_status_spouse != "":
tags.append(first_column + marital_status_spouse_q + second_column + marital_status_spouse + end_tag)
return ''.join(tags)
@register.simple_tag
def property_tag(source):
"""
Reformat your_property and debt step
Also show/hide optional questions
"""
tags = []
first_column = '<tr><td width="75%" style="padding-right: 5%">'
second_column = '</td><td width="25%">'
end_tag = '</td></tr>'
division = division_detail = want_other = other_detail = None
for item in source:
q_id = item['question_id']
if q_id == 'deal_with_property_debt':
division = item
elif q_id == 'how_to_divide_property_debt':
division_detail = item
elif q_id == 'want_other_property_claims':
want_other = item
elif q_id == 'other_property_claims':
other_detail = item
if division:
tags.append(first_column + division['question__name'] + second_column + division['value'] + end_tag)
if division['value'] == "Unequal division" and division_detail:
tags.append(first_column + division_detail['question__name'] + second_column + process_list(division_detail['value'].split('\n'), division_detail['question_id']) + end_tag)
if want_other and other_detail:
tags.append(first_column + other_detail['question__name'] + second_column + process_list(other_detail['value'].split('\n'), other_detail['question_id']) + end_tag)
return ''.join(tags)
@register.simple_tag
def prequal_tag(source):
"""
Reformat prequalification step
Also show/hide optional questions
"""
tags = []
first_column = '<tr><td width="75%" style="padding-right: 5%">'
second_column = '</td><td width="25%">'
end_tag = '</td></tr>'
marriage_status = lived_in_bc = live_at_least_year = separation_date = try_reconcile = reconciliation_period = None
children_of_marriage = any_under_19 = financial_support = certificate = provide_later = None
provide_later_reason = not_provide_later_reason = in_english = divorce_reason = None
for item in source:
q_id = item['question_id']
if q_id == 'married_marriage_like':
marriage_status = item
elif q_id == 'lived_in_bc':
lived_in_bc = item
elif q_id == 'lived_in_bc_at_least_year':
live_at_least_year = item
elif q_id == 'separation_date':
separation_date = item
elif q_id == 'try_reconcile_after_separated':
try_reconcile = item
elif q_id == 'reconciliation_period':
reconciliation_period = item
elif q_id == 'children_of_marriage':
children_of_marriage = item
elif q_id == 'any_under_19':
any_under_19 = item
elif q_id == 'children_financial_support':
financial_support = item
elif q_id == 'original_marriage_certificate':
certificate = item
elif q_id == 'provide_certificate_later':
provide_later = item
elif q_id == 'provide_certificate_later_reason':
provide_later_reason = item
elif q_id == 'not_provide_certificate_reason':
not_provide_later_reason = item
elif q_id == 'marriage_certificate_in_english':
in_english = item
elif q_id == 'divorce_reason':
divorce_reason = item
if marriage_status:
tags.append(first_column + marriage_status['question__name'] + second_column + marriage_status['value'] + end_tag)
if lived_in_bc:
tags.append(first_column + lived_in_bc['question__name'] + second_column + lived_in_bc['value'] + end_tag)
if live_at_least_year:
tags.append(first_column + live_at_least_year['question__name'] + second_column + live_at_least_year['value'] + end_tag)
if separation_date:
tags.append(first_column + separation_date['question__name'] + second_column + separation_date['value'] + end_tag)
if try_reconcile:
tags.append(first_column + try_reconcile['question__name'] + second_column + try_reconcile['value'] + end_tag)
if try_reconcile['value'] == 'YES' and reconciliation_period:
tags.append(first_column + reconciliation_period['question__name'] + second_column + reconciliation_period_reformat(reconciliation_period['value']) + end_tag)
if children_of_marriage:
tags.append(first_column + children_of_marriage['question__name'] + second_column + children_of_marriage['value'] + end_tag)
if children_of_marriage['value'] == 'YES' and any_under_19:
tags.append(first_column + any_under_19['question__name'] + second_column + any_under_19['value'] + end_tag)
if children_of_marriage['value'] == 'YES' and any_under_19['value'] == 'NO' and financial_support:
tags.append(first_column + financial_support['question__name'] + second_column + json.loads(financial_support['value'])[0] + end_tag)
if certificate:
tags.append(first_column + certificate['question__name'] + second_column + certificate['value'] + end_tag)
if certificate['value'] == 'NO' and provide_later:
tags.append(first_column + provide_later['question__name'] + second_column + provide_later['value'] + end_tag)
if certificate['value'] == 'NO' and provide_later['value'] == 'YES' and provide_later_reason:
tags.append(first_column + provide_later_reason['question__name'] + second_column + process_list(provide_later_reason['value'].split('\n'), provide_later_reason['question_id']) + end_tag)
if certificate['value'] == 'NO' and provide_later['value'] == 'NO' and not_provide_later_reason:
tags.append(first_column + not_provide_later_reason['question__name'] + second_column + process_list(not_provide_later_reason['value'].split('\n'), not_provide_later_reason['question_id']) + end_tag)
if marriage_status['value'] == 'Living together in a marriage like relationship' and in_english:
tags.append(first_column + in_english['question__name'] + second_column + in_english['value'] + end_tag)
if divorce_reason:
tags.append(first_column + divorce_reason['question__name'] + second_column + divorce_reason['value'] + end_tag)
return ''.join(tags)
@register.simple_tag
def personal_info_tag(source):
"""
Reformat your information and your spouse step
Also show/hide optional questions
"""
tags = []
first_column = '<tr><td width="75%" style="padding-right: 5%">'
second_column = '</td><td width="25%">'
end_tag = '</td></tr>'
name = other_name = other_name_list = last_name_born = last_name_before = None
birthday = occupation = lived_bc = moved_bc = None
for item in source:
q_id = item['question_id']
if q_id.startswith('name_'):
name = item
elif q_id.startswith('any_other_name_'):
other_name = item
elif q_id.startswith('other_name_'):
other_name_list = item
elif q_id.startswith('last_name_born_'):
last_name_born = item
elif q_id.startswith('last_name_before_married_'):
last_name_before = item
elif q_id.startswith('birthday_'):
birthday = item
elif q_id.startswith('occupation_'):
occupation = item
elif q_id.startswith('lived_in_bc_'):
lived_bc = item
elif q_id.startswith('moved_to_bc_date_'):
moved_bc = item
if name:
tags.append(first_column + name['question__name'] + second_column + name['value'] + end_tag)
if other_name:
tags.append(first_column + other_name['question__name'] + second_column + other_name['value'] + end_tag)
if other_name['value'] == 'YES' and other_name_list:
tags.append(first_column + other_name_list['question__name'] + second_column + process_list(json.loads(other_name_list['value']), other_name_list['question_id']) + end_tag)
if last_name_born:
tags.append(first_column + last_name_born['question__name'] + second_column + last_name_born['value'] + end_tag)
if last_name_before:
tags.append(first_column + last_name_before['question__name'] + second_column + last_name_before['value'] + end_tag)
if birthday:
tags.append(first_column + birthday['question__name'] + second_column + birthday['value'] + end_tag)
if occupation:
tags.append(first_column + occupation['question__name'] + second_column + occupation['value'] + end_tag)
if lived_bc['value'] == "Moved to B.C. on":
tags.append(first_column + lived_bc['question__name'] + second_column + lived_bc['value'] + ' ' + moved_bc['value'] + end_tag)
if lived_bc['value'] != "Moved to B.C. on" and lived_bc:
tags.append(first_column + lived_bc['question__name'] + second_column + lived_bc['value'] + end_tag)
return ''.join(tags)
def reconciliation_period_reformat(lst):
"""
Reformat reconciliation period into From [dd/mm/yyyy] to [dd/mm/yyyy] format
"""
try:
lst = json.loads(lst)
except:
lst = []
period = ""
for f_date, t_date in lst:
period += "From " + f_date + " to " + t_date + "<br />"
return period

+ 47
- 48
edivorce/apps/core/tests.py View File

@ -10,7 +10,6 @@ class UserResponseTestCase(TestCase):
def setUp(self):
BceidUser.objects.create(user_guid='1234')
Question.objects.create(key='test', name='this is test')
def test_which_order(self):
step = 'which_orders'
@ -18,19 +17,19 @@ class UserResponseTestCase(TestCase):
user = BceidUser.objects.get(user_guid='1234')
# No response should be False
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required question
create_response(user, 'want_which_orders', '["nothing"]')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
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')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
def test_your_info(self):
@ -39,7 +38,7 @@ class UserResponseTestCase(TestCase):
user = BceidUser.objects.get(user_guid='1234')
# No response should be False
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# Testing required questions
@ -49,55 +48,55 @@ class UserResponseTestCase(TestCase):
create_response(user, 'birthday_you', '11/11/1111')
create_response(user, 'occupation_you', 'Plumber')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# Few required questions with one checking question with hidden question not shown
create_response(user, 'lived_in_bc_you', '11/11/1111')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required questions with one checking question with hidden question not shown
create_response(user, 'last_name_born_you', 'Jackson')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required questions with one checking question with hidden question missing
UserResponse.objects.filter(question_id='lived_in_bc_you').update(value="Moved to B.C. on")
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required questions with one checking question with hidden question
create_response(user, 'moved_to_bc_date_you', '12/12/1212')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required questions with two checking question with one hidden and one shown
create_response(user, 'any_other_name_you', 'NO')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), True)
# All required questions with two checking question with one hidden question missing
UserResponse.objects.filter(question_id='any_other_name_you').update(value="YES")
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required questions with all checking question with all hidden questions
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', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), True)
# Put empty response
UserResponse.objects.filter(question_id='other_name_you').update(value='[["also known as",""]]')
UserResponse.objects.filter(question_id='other_name_you').update(value='[["",""]]')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
def test_your_spouse(self):
@ -106,7 +105,7 @@ class UserResponseTestCase(TestCase):
user = BceidUser.objects.get(user_guid='1234')
# No response should be False
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# Testing required questions
@ -116,61 +115,61 @@ class UserResponseTestCase(TestCase):
create_response(user, 'birthday_spouse', '11/11/1111')
create_response(user, 'occupation_spouse', 'Electrician')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# Few required questions with one checking question with hidden question not shown
create_response(user, 'any_other_name_spouse', 'NO')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required questions with one checking question with hidden question not shown
create_response(user, 'last_name_born_spouse', 'Jackson')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required questions with one checking question with hidden question missing
UserResponse.objects.filter(question_id='any_other_name_spouse').update(value="YES")
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required questions with one checking question with hidden question
create_response(user, 'lived_in_bc_spouse', '11/11/1111')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required questions with two checking question with one hidden and one shown
create_response(user, 'other_name_spouse', '[["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', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), True)
# All required questions with two checking question with one hidden question missing
UserResponse.objects.filter(question_id='lived_in_bc_spouse').update(value="Moved to B.C. on")
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required questions with all checking question with all hidden questions
create_response(user, 'moved_to_bc_date_spouse', '12/12/1212')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
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')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# Put empty response
UserResponse.objects.filter(question_id='other_name_spouse').update(value='[["also known as",""]]')
UserResponse.objects.filter(question_id='other_name_spouse').update(value='[["",""]]')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
def test_your_marriage(self):
@ -182,19 +181,19 @@ class UserResponseTestCase(TestCase):
user = BceidUser.objects.get(user_guid='1234')
# No response should be False
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required question
create_response(user, 'no_reconciliation_possible', 'I agree')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# 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')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
def test_spousal_support(self):
@ -203,31 +202,31 @@ class UserResponseTestCase(TestCase):
user = BceidUser.objects.get(user_guid='1234')
# No response should be False
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# One required question
create_response(user, 'spouse_support_details', 'I will support you')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# Two required questions
create_response(user, 'spouse_support_act', 'Family Law')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), True)
# Remove first added required response to test the second required question
UserResponse.objects.get(question_id='spouse_support_details').delete()
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
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')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
def test_property_and_debt(self):
@ -236,43 +235,43 @@ class UserResponseTestCase(TestCase):
user = BceidUser.objects.get(user_guid='1234')
# No response should be False
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required question with no hidden shown
create_response(user, 'deal_with_property_debt', 'equal division')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required question with hidden shown but no response
UserResponse.objects.filter(question_id='deal_with_property_debt').update(value="unequal division")
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# Only one required question with hidden shown and answered
create_response(user, 'how_to_divide_property_debt', 'Do not divide them')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# Only two required question with hidden shown and answered
create_response(user, 'want_other_property_claims', 'Ask for other property claims')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required question with hidden shown and answered
create_response(user, 'other_property_claims', 'Want these property claims')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), True)
# Put empty response
UserResponse.objects.filter(question_id='want_other_property_claims').update(value="")
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
def test_other_orders(self):
@ -281,19 +280,19 @@ class UserResponseTestCase(TestCase):
user = BceidUser.objects.get(user_guid='1234')
# No response should be False
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required question
create_response(user, 'other_orders_detail', 'I want more orders')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
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')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
def test_other_questions(self):
@ -305,19 +304,19 @@ class UserResponseTestCase(TestCase):
user = BceidUser.objects.get(user_guid='1234')
# No response should be False
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)
# All required question
create_response(user, 'court_registry_for_filing', 'Vancouver')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
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')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value', 'question__conditional_target', 'question__reveal_response')
self.assertEqual(is_complete(step, lst), False)


+ 13
- 10
edivorce/apps/core/utils/question_step_mapping.py View File

@ -15,7 +15,7 @@ question_step_mapping = {'prequalification': ['married_marriage_like', 'lived_in
'occupation_spouse'],
'your_marriage': ['when_were_you_married', 'where_were_you_married_city', 'where_were_you_married_prov',
'where_were_you_married_country', 'where_were_you_married_other_country', 'marital_status_before_you',
'marital_status_before_spouse', 'when_were_you_live_married_like', ],
'marital_status_before_spouse', 'when_were_you_live_married_like', 'married_marriage_like'],
'your_separation': ['no_reconciliation_possible', 'no_collusion',],
'spousal_support': ['spouse_support_details', 'spouse_support_act',],
'property_and_debt': ['deal_with_property_debt', 'how_to_divide_property_debt', 'other_property_claims', 'want_other_property_claims'],
@ -54,18 +54,21 @@ list_of_registries = ['Fort St. John', 'Dawson Creek', 'Prince Rupert', 'Terrace
complete_state_for_step = {'which_orders': {'required': ['want_which_orders']},
'your_information': {'required': ['name_you', 'last_name_born_you',
'last_name_before_married_you', 'birthday_you', 'occupation_you'],
'conditional': {'any_other_name_you': ['YES', 'other_name_you'],
'lived_in_bc_you': ['Moved to B.C. on', 'moved_to_bc_date_you']},},
'conditional': {'any_other_name_you': ['YES', ['other_name_you']],
'lived_in_bc_you': ['Moved to B.C. on', ['moved_to_bc_date_you']]},},
'your_spouse': {'required': ['name_spouse', 'last_name_born_spouse',
'last_name_before_married_spouse', 'birthday_spouse', 'occupation_spouse'],
'conditional': {'any_other_name_spouse': ['YES', 'other_name_spouse'],
'lived_in_bc_spouse': ['Moved to B.C. on', 'moved_to_bc_date_spouse']},},
'conditional': {'any_other_name_spouse': ['YES', ['other_name_spouse']],
'lived_in_bc_spouse': ['Moved to B.C. on', ['moved_to_bc_date_spouse']]},},
'your_marriage': {'required': ['when_were_you_live_married_like', 'marital_status_before_you', 'marital_status_before_spouse'],
'conditional': {'married_marriage_like': ['Legally married', 'when_were_you_married']}},
'conditional': {'married_marriage_like': ['Legally married', ['when_were_you_married',
'where_were_you_married_city',
'where_were_you_married_prov',
'where_were_you_married_country']]}},
'your_separation': {'required': ['no_reconciliation_possible', 'no_collusion']},
'spousal_support': {'required': ['spouse_support_details', 'spouse_support_act']},
'property_and_debt': {'required': ['want_other_property_claims', 'other_property_claims'],
'conditional': {'deal_with_property_debt': ['unequal division', 'how_to_divide_property_debt']}},
'conditional': {'deal_with_property_debt': ['unequal division', ['how_to_divide_property_debt']]}},
'other_orders': {'required': ['other_orders_detail']},
'other_questions': {'required': ['address_to_send_official_document_street_you',
'address_to_send_official_document_city_you',
@ -75,8 +78,8 @@ complete_state_for_step = {'which_orders': {'required': ['want_which_orders']},
'address_to_send_official_document_city_spouse',
'address_to_send_official_document_prov_spouse',
'address_to_send_official_document_postal_code_spouse'],
'conditional': {'address_to_send_official_document_country_you': ['Other', 'address_to_send_official_document_other_country_you'],
'address_to_send_official_document_country_spouse': ['Other', 'address_to_send_official_document_other_country_spouse'],
'divorce_take_effect_on': ['specific date', 'divorce_take_effect_on_specific_date']}},
'conditional': {'address_to_send_official_document_country_you': ['Other', ['address_to_send_official_document_other_country_you']],
'address_to_send_official_document_country_spouse': ['Other', ['address_to_send_official_document_other_country_spouse']],
'divorce_take_effect_on': ['specific date', ['divorce_take_effect_on_specific_date']]}},
'filing_locations': {'required': ['court_registry_for_filing']},
}

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

@ -16,7 +16,7 @@ def get_responses_from_db_grouped_by_steps(bceid_user):
responses = UserResponse.objects.filter(bceid_user=bceid_user)
responses_dict = {}
for step, questions in question_step_mapping.items():
responses_dict[step] = responses.filter(question_id__in=questions).exclude(value__in=['', '[]']).order_by('question').values('question_id', 'value', 'question__name')
responses_dict[step] = responses.filter(question_id__in=questions).exclude(value__in=['', '[]', '[["",""]]']).order_by('question').values('question_id', 'value', 'question__name', 'question__required', 'question__conditional_target', 'question__reveal_response')
return responses_dict
@ -73,35 +73,35 @@ def copy_session_to_db(request, bceid_user):
def is_complete(step, lst):
"""
Check required field of question for complete state
Required: question is always require user response to be complete
Conditional: question itself is required and depends on the response to this question,
optional question may be also required
"""
if not lst:
return False
required_dict = deepcopy(complete_state_for_step)
if step in required_dict:
required_list = required_dict[step]['required']
conditional_list = required_dict[step]['conditional'] if 'conditional' in required_dict[step] else []
for question in lst:
question_list = Question.objects.filter(key__in=question_step_mapping[step])
required_list = list(question_list.filter(required='Required').values_list("key", flat=True))
conditional_list = list(question_list.filter(required='Conditional').values_list("key", flat=True))
for question in lst:
q_val = question['value']
if q_val != "" and q_val != "[]" and q_val != '[["",""]]':
q_id = question['question_id']
value = question['value']
if value != '[]' and value.strip() != '':
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:
if (hidden_q_id == 'other_name_you' or hidden_q_id == 'other_name_spouse') and not json.loads(key['value'])[0][1]:
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:
return True
if q_id in required_list:
required_list.remove(q_id)
elif q_id in conditional_list:
if q_val == question['question__reveal_response']:
key_in_list = False
for key in lst:
k_val = key['value']
if key['question_id'] == question['question__conditional_target']:
if k_val != "" and k_val != "[]" and k_val != '[["",""]]':
key_in_list = True
break
if key_in_list is False:
return False
conditional_list.remove(q_id)
if not required_list and not conditional_list:
return True
return False

+ 6
- 3
edivorce/apps/core/views/main.py View File

@ -122,13 +122,15 @@ def question(request, step):
responses_dict = responses_dict_by_step
else:
responses_dict = get_responses_from_db(user)
# Add step status dictionary
responses_dict['step_status'] = get_step_status(responses_dict_by_step)
responses_dict['active_page'] = step
# If page is filing location page, add registries dictionary for list of court registries
if step == "location":
responses_dict['registries'] = sorted(list_of_registries)
# Add step status dictionary
responses_dict['step_status'] = get_step_status(responses_dict_by_step)
return render(request, template_name=template, context=responses_dict)
@ -141,10 +143,11 @@ def overview(request):
"""
user = __get_bceid_user(request)
responses_dict_by_step = get_responses_from_db_grouped_by_steps(user)
responses_dict_by_step['active_page'] = 'overview'
# Add step status dictionary
responses_dict_by_step['step_status'] = get_step_status(responses_dict_by_step)
responses_dict_by_step['active_page'] = 'overview'
return render(request, 'overview.html', context=responses_dict_by_step)


+ 108
- 41
edivorce/fixtures/Question.json View File

@ -138,7 +138,8 @@
"fields": {
"name": "What are you asking for (Orders)?",
"description": "For step 1",
"summary_order": 16
"summary_order": 16,
"required": "Required"
},
"model": "core.question",
"pk": "want_which_orders"
@ -147,7 +148,8 @@
"fields": {
"name": "Please enter your name (as it appears on the marriage certificate).",
"description": "For step 2, Form 1 Claimant 1",
"summary_order": 17
"summary_order": 17,
"required": "Required"
},
"model": "core.question",
"pk": "name_you"
@ -156,7 +158,10 @@
"fields": {
"name": "Do you go by any other names?",
"description": "For step 2",
"summary_order": 18
"summary_order": 18,
"required": "Conditional",
"conditional_target": "other_name_you",
"reveal_response": "YES"
},
"model": "core.question",
"pk": "any_other_name_you"
@ -174,7 +179,8 @@
"fields": {
"name": "What was your last name when you were born?",
"description": "For step 2, Form 1 2. Divorce section A",
"summary_order": 20
"summary_order": 20,
"required": "Required"
},
"model": "core.question",
"pk": "last_name_born_you"
@ -183,7 +189,8 @@
"fields": {
"name": "What was your last name before you were married?",
"description": "For step 2, Form 1 2. Divorce section A",
"summary_order": 21
"summary_order": 21,
"required": "Required"
},
"model": "core.question",
"pk": "last_name_before_married_you"
@ -192,7 +199,8 @@
"fields": {
"name": "What is your date of birth?",
"description": "For step 2, Form 1 2. Divorce section A",
"summary_order": 22
"summary_order": 22,
"required": "Required"
},
"model": "core.question",
"pk": "birthday_you"
@ -201,7 +209,8 @@
"fields": {
"name": "What is your occupation?",
"description": "For step 2, Form 38 first question",
"summary_order": 23
"summary_order": 23,
"required": "Required"
},
"model": "core.question",
"pk": "occupation_you"
@ -210,7 +219,10 @@
"fields": {
"name": "How long have you lived in B.C.?",
"description": "For step 2, Form 1 2. Divorce section A",
"summary_order": 24
"summary_order": 24,
"required": "Conditional",
"conditional_target": "moved_to_bc_date_you",
"reveal_response": "Moved to B.C. on"
},
"model": "core.question",
"pk": "lived_in_bc_you"
@ -228,7 +240,8 @@
"fields": {
"name": "Please enter your spouse's name (as it appears on the marriage certificate).",
"description": "For step 3, Form 1 Claimant 2",
"summary_order": 26
"summary_order": 26,
"required": "Required"
},
"model": "core.question",
"pk": "name_spouse"
@ -237,7 +250,10 @@
"fields": {
"name": "Does your spouse go by any other names?",
"description": "For step 3",
"summary_order": 27
"summary_order": 27,
"required": "Conditional",
"conditional_target": "other_name_spouse",
"reveal_response": "YES"
},
"model": "core.question",
"pk": "any_other_name_spouse"
@ -255,7 +271,8 @@
"fields": {
"name": "What was their last name at birth?",
"description": "For step 3, Form 1 2. Divorce section A",
"summary_order": 29
"summary_order": 29,
"required": "Required"
},
"model": "core.question",
"pk": "last_name_born_spouse"
@ -264,7 +281,8 @@
"fields": {
"name": "What was their last name before you were married?",
"description": "For step 3, Form 1 2. Divorce section A",
"summary_order": 30
"summary_order": 30,
"required": "Required"
},
"model": "core.question",
"pk": "last_name_before_married_spouse"
@ -273,7 +291,8 @@
"fields": {
"name": "What is your spouse's date of birth?",
"description": "For step 3, Form 1 2. Divorce section A",
"summary_order": 31
"summary_order": 31,
"required": "Required"
},
"model": "core.question",
"pk": "birthday_spouse"
@ -282,7 +301,8 @@
"fields": {
"name": "What is your spouse's occupation?",
"description": "For step 3, Form 38 first question",
"summary_order": 33
"summary_order": 33,
"required": "Required"
},
"model": "core.question",
"pk": "occupation_spouse"
@ -291,7 +311,10 @@
"fields": {
"name": "How long has your spouse lived in B.C.?",
"description": "For step 3, Form 1 2. Divorce section A",
"summary_order": 33
"summary_order": 33,
"required": "Conditional",
"conditional_target": "moved_to_bc_date_spouse",
"reveal_response": "Moved to B.C. on"
},
"model": "core.question",
"pk": "lived_in_bc_spouse"
@ -309,7 +332,10 @@
"fields": {
"name": "When were you married?",
"description": "For step 4, Form 1 1. Relationship history",
"summary_order": 35
"summary_order": 35,
"required": "Conditional",
"conditional_target": "married_marriage_like",
"reveal_response": "Legally married"
},
"model": "core.question",
"pk": "when_were_you_married"
@ -318,7 +344,8 @@
"fields": {
"name": "When did you and your spouse begin to live together in a marriage-like relationship?",
"description": "For step 4, Form 1 1. Relationship history",
"summary_order": 36
"summary_order": 36,
"required": "Required"
},
"model": "core.question",
"pk": "when_were_you_live_married_like"
@ -327,7 +354,10 @@
"fields": {
"name": "Where were you married?",
"description": "For step 4, Form 1 2. Divorce section A",
"summary_order": 37
"summary_order": 37,
"required": "Conditional",
"conditional_target": "married_marriage_like",
"reveal_response": "Legally married"
},
"model": "core.question",
"pk": "where_were_you_married_city"
@ -336,7 +366,10 @@
"fields": {
"name": "Where were you married? Prov",
"description": "For step 4, Form 1 2. Divorce section A",
"summary_order": 38
"summary_order": 38,
"required": "Conditional",
"conditional_target": "married_marriage_like",
"reveal_response": "Legally married"
},
"model": "core.question",
"pk": "where_were_you_married_prov"
@ -345,7 +378,10 @@
"fields": {
"name": "Where were you married? Country",
"description": "For step 4, Form 1 2. Divorce section A",
"summary_order": 39
"summary_order": 39,
"required": "Conditional",
"conditional_target": "where_were_you_married_other_country",
"reveal_response": "Other"
},
"model": "core.question",
"pk": "where_were_you_married_country"
@ -363,7 +399,8 @@
"fields": {
"name": "Before you got married to your spouse, what was your marital status?",
"description": "For step 4, Form 1 2. Divorce section A",
"summary_order": 41
"summary_order": 41,
"required": "Required"
},
"model": "core.question",
"pk": "marital_status_before_you"
@ -372,7 +409,8 @@
"fields": {
"name": "What was the marital status of your spouse before your marriage?",
"description": "For step 4, Form 1 2. Divorce section A",
"summary_order": 42
"summary_order": 42,
"required": "Required"
},
"model": "core.question",
"pk": "marital_status_before_spouse"
@ -381,7 +419,8 @@
"fields": {
"name": "There is no possibility my spouse and I will get back together (reconciliation).",
"description": "For step 5, Form 1 2. Divorce section C",
"summary_order": 43
"summary_order": 43,
"required": "Required"
},
"model": "core.question",
"pk": "no_reconciliation_possible"
@ -390,7 +429,8 @@
"fields": {
"name": "My spouse and I have not engaged in collusion to deceive the court in any way.",
"description": "For step 5, Form 1 2. Divorce section C",
"summary_order": 44
"summary_order": 44,
"required": "Required"
},
"model": "core.question",
"pk": "no_collusion"
@ -399,7 +439,8 @@
"fields": {
"name": "You and your spouse are asking for an order for spousal support as follows",
"description": "For step 6, Form 1 5. Spousal support",
"summary_order": 45
"summary_order": 45,
"required": "Required"
},
"model": "core.question",
"pk": "spouse_support_details"
@ -408,7 +449,8 @@
"fields": {
"name": "Please indicate which act you are asking for support under.",
"description": "For step 6, Form 1 5. Spousal support",
"summary_order": 46
"summary_order": 46,
"required": "Required"
},
"model": "core.question",
"pk": "spouse_support_act"
@ -417,7 +459,10 @@
"fields": {
"name": "How have you and your spouse agreed to deal with your property and debt?",
"description": "For step 7, Form 1 6. Property and debt",
"summary_order": 47
"summary_order": 47,
"required": "Conditional",
"conditional_target": "how_to_divide_property_debt",
"reveal_response": "Unequal division"
},
"model": "core.question",
"pk": "deal_with_property_debt"
@ -435,7 +480,10 @@
"fields": {
"name": "Claimant 1 and Claimant 2 ask for an order respecting an interest in property or for compensation instead of an interest in that property, as follows",
"description": "For step 7, Form 1 6. Property and debt",
"summary_order": 49
"summary_order": 49,
"required": "Conditional",
"conditional_target": "other_property_claims",
"reveal_response": "Ask for other property claims"
},
"model": "core.question",
"pk": "want_other_property_claims"
@ -453,7 +501,8 @@
"fields": {
"name": "Please list any other orders",
"description": "For step 8 other orders",
"summary_order": 51
"summary_order": 51,
"required": "Required"
},
"model": "core.question",
"pk": "other_orders_detail"
@ -462,7 +511,8 @@
"fields": {
"name": "What is the best address to send you official court documents?",
"description": "For step 9, Form 1 8. Claimants' addresses for service",
"summary_order": 52
"summary_order": 52,
"required": "Required"
},
"model": "core.question",
"pk": "address_to_send_official_document_street_you"
@ -471,7 +521,8 @@
"fields": {
"name": "City",
"description": "For step 9, Form 1 8. Claimants' addresses for service",
"summary_order": 53
"summary_order": 53,
"required": "Required"
},
"model": "core.question",
"pk": "address_to_send_official_document_city_you"
@ -480,7 +531,8 @@
"fields": {
"name": "Prov",
"description": "For step 9, Form 1 8. Claimants' addresses for service",
"summary_order": 54
"summary_order": 54,
"required": "Required"
},
"model": "core.question",
"pk": "address_to_send_official_document_prov_you"
@ -489,7 +541,10 @@
"fields": {
"name": "Country",
"description": "For step 9, Form 1 8. Claimants' addresses for service",
"summary_order": 55
"summary_order": 55,
"required": "Conditional",
"conditional_target": "address_to_send_official_document_other_country_you",
"reveal_response": "Other"
},
"model": "core.question",
"pk": "address_to_send_official_document_country_you"
@ -507,7 +562,8 @@
"fields": {
"name": "Postal code",
"description": "For step 9, Form 1 8. Claimants' addresses for service",
"summary_order": 57
"summary_order": 57,
"required": "Required"
},
"model": "core.question",
"pk": "address_to_send_official_document_postal_code_you"
@ -534,7 +590,8 @@
"fields": {
"name": "What is the best address to send your spouse official court documents?",
"description": "For step 9, Form 1 8. Claimants' addresses for service",
"summary_order": 60
"summary_order": 60,
"required": "Required"
},
"model": "core.question",
"pk": "address_to_send_official_document_street_spouse"
@ -543,7 +600,8 @@
"fields": {
"name": "City",
"description": "For step 9, Form 1 8. Claimants' addresses for service",
"summary_order": 61
"summary_order": 61,
"required": "Required"
},
"model": "core.question",
"pk": "address_to_send_official_document_city_spouse"
@ -552,7 +610,8 @@
"fields": {
"name": "Prov",
"description": "For step 9, Form 1 8. Claimants' addresses for service",
"summary_order": 62
"summary_order": 62,
"required": "Required"
},
"model": "core.question",
"pk": "address_to_send_official_document_prov_spouse"
@ -561,7 +620,10 @@
"fields": {
"name": "Country",
"description": "For step 9, Form 1 8. Claimants' addresses for service",
"summary_order": 63
"summary_order": 63,
"required": "Conditional",
"conditional_target": "address_to_send_official_document_other_country_spouse",
"reveal_response": "Other"
},
"model": "core.question",
"pk": "address_to_send_official_document_country_spouse"
@ -579,7 +641,8 @@
"fields": {
"name": "Postal code",
"description": "For step 9, Form 1 8. Claimants' addresses for service",
"summary_order": 65
"summary_order": 65,
"required": "Required"
},
"model": "core.question",
"pk": "address_to_send_official_document_postal_code_spouse"
@ -606,7 +669,10 @@
"fields": {
"name": "Divorce is to take effect on",
"description": "For step 9, Form 52 This Court Orders that",
"summary_order": 68
"summary_order": 68,
"required": "Conditional",
"conditional_target": "divorce_take_effect_on_specific_date",
"reveal_response": "specific date"
},
"model": "core.question",
"pk": "divorce_take_effect_on"
@ -624,7 +690,8 @@
"fields": {
"name": "Please enter the details for any other orders that you are asking for.",
"description": "For step 10, Form 1 court registry",
"summary_order": 70
"summary_order": 70,
"required": "Required"
},
"model": "core.question",
"pk": "court_registry_for_filing"


Loading…
Cancel
Save