Browse Source

Updated complete state for some steps

pull/160/head
Charles Shin 8 years ago
parent
commit
a34fc9edbf
6 changed files with 33 additions and 18 deletions
  1. +1
    -1
      edivorce/apps/core/templates/pdf/form38.html
  2. +1
    -1
      edivorce/apps/core/templates/pdf/form38_we.html
  3. +2
    -2
      edivorce/apps/core/templates/question/06_support.html
  4. +24
    -6
      edivorce/apps/core/tests.py
  5. +3
    -3
      edivorce/apps/core/utils/question_step_mapping.py
  6. +2
    -5
      edivorce/apps/core/utils/user_response.py

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

@ -85,7 +85,7 @@
{% for period in periods %}
from {{ period | first }} to {{ period | last }}{% if not forloop.last %}, {% endif %}
{% endfor %}.
{% else %}<span class="form-entry not-complete">[<em>provide dates of any periods of attempted reconciliation</em>]</span>.{% endif %}
{% 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">


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

@ -95,7 +95,7 @@
{% for period in periods %}
from {{ period | first }} to {{ period | last }}{% if not forloop.last %}, {% endif %}
{% endfor %}.
{% else %}<span class="form-entry not-complete">[<em>provide dates of any periods of attempted reconciliation</em>]</span>.{% endif %}
{% 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">


+ 2
- 2
edivorce/apps/core/templates/question/06_support.html View File

@ -100,8 +100,8 @@
<div class="question-well">
<h3>Please indicate which act you are asking for support under.</h3>
<div class="radio"><label>{% input_field type="radio" name="spouse_support_act" value="divorce" data_target_id="family_law_time_limit" data_reveal_target="false" %}the Divorce Act (Canada)</label> - <a href="http://laws-lois.justice.gc.ca/eng/acts/D-3.4/index.html">view the Divorce Act</a></div>
<div class="radio"><label>{% input_field type="radio" name="spouse_support_act" value="family" data_target_id="family_law_time_limit" data_reveal_target="true" %}the Family Law Act</label> - <a href="http://www.bclaws.ca/civix/document/id/complete/statreg/11025_01">view the Family Law Act</a></div>
<div class="radio"><label>{% input_field type="radio" name="spouse_support_act" value="divorce" data_target_id="family_law_time_limit" data_reveal_target="false" %}the Divorce Act (Canada)</label> - <a href="http://laws-lois.justice.gc.ca/eng/acts/D-3.4/index.html" target="_blank">view the Divorce Act</a></div>
<div class="radio"><label>{% input_field type="radio" name="spouse_support_act" value="family" data_target_id="family_law_time_limit" data_reveal_target="true" %}the Family Law Act</label> - <a href="http://www.bclaws.ca/civix/document/id/complete/statreg/11025_01" target="_blank">view the Family Law Act</a></div>
<div class="information-message bg-danger" id="family_law_time_limit" hidden>
<h2>Time limit to apply for court order</h2>


+ 24
- 6
edivorce/apps/core/tests.py View File

@ -65,7 +65,7 @@ class UserResponseTestCase(TestCase):
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 British Columbia on")
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')
self.assertEqual(is_complete(step, lst), False)
@ -144,13 +144,13 @@ class UserResponseTestCase(TestCase):
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', 'Smith')
create_response(user, 'other_name_spouse', '[["also known as","Smith"]]')
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
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 British Columbia on")
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')
self.assertEqual(is_complete(step, lst), False)
@ -167,6 +167,12 @@ class UserResponseTestCase(TestCase):
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), False)
# Put empty response
UserResponse.objects.filter(question_id='other_name_spouse').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_marriage(self):
pass
@ -237,7 +243,7 @@ class UserResponseTestCase(TestCase):
create_response(user, 'deal_with_property_debt', 'equal division')
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), False)
# All required question with hidden shown but no response
UserResponse.objects.filter(question_id='deal_with_property_debt').update(value="unequal division")
@ -245,14 +251,26 @@ class UserResponseTestCase(TestCase):
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), False)
# All required question with hidden shown and answered
# 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')
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')
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')
self.assertEqual(is_complete(step, lst), True)
# Put empty response
UserResponse.objects.filter(question_id='how_to_divide_property_debt').update(value="")
UserResponse.objects.filter(question_id='want_other_property_claims').update(value="")
lst = UserResponse.objects.filter(question_id__in=questions).values('question_id', 'value')
self.assertEqual(is_complete(step, lst), False)


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

@ -55,16 +55,16 @@ 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 British Columbia on', 'moved_to_bc_date_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 British Columbia on', 'moved_to_bc_date_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']}},
'your_separation': {'required': ['no_reconciliation_possible', 'no_collusion']},
'spousal_support': {'required': ['spouse_support_details', 'spouse_support_act']},
'property_and_debt': {'required': [],
'property_and_debt': {'required': ['want_other_property_claims', 'other_property_claims'],
'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',


+ 2
- 5
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).values('question_id', 'value', 'question__name')
responses_dict[step] = responses.filter(question_id__in=questions).exclude(value__in=['', '[]']).values('question_id', 'value', 'question__name')
return responses_dict
@ -92,10 +92,7 @@ def is_complete(step, lst):
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'] or key['value'].strip() == '':
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


Loading…
Cancel
Save