Browse Source

Reverted the change in DIV-1158 to make any_other_names field optional. It causes several other bugs

pull/172/head
Michael Olund 5 years ago
parent
commit
1421fff80f
5 changed files with 16 additions and 14 deletions
  1. +1
    -1
      edivorce/apps/core/templates/question/02_claimant.html
  2. +1
    -1
      edivorce/apps/core/templates/question/03_respondent.html
  3. +7
    -7
      edivorce/apps/core/tests/test_step_completeness.py
  4. +5
    -3
      edivorce/apps/core/utils/user_response.py
  5. +2
    -2
      edivorce/fixtures/Question.json

+ 1
- 1
edivorce/apps/core/templates/question/02_claimant.html View File

@ -60,7 +60,7 @@
</div>
<div class="question-well {% if any_other_name_you_error %}error{% endif %}">
<h3>Do you go by any other names?{% include "partials/optional.html" %}</h3>
<h3>Do you go by any other names?{% if any_other_name_you_error %}{% include 'partials/required.html' %}{% endif %}</h3>
<div class="btn-radio-group" data-toggle="buttons">
<label class="btn btn-radio">


+ 1
- 1
edivorce/apps/core/templates/question/03_respondent.html View File

@ -65,7 +65,7 @@
</div>
<div class="question-well {% if any_other_name_spouse_error %}error{% endif %}">
<h3>Does your spouse go by any other names?{% include "partials/optional.html" %}</h3>
<h3>Does your spouse go by any other names?{% if any_other_name_spouse_error %}{% include 'partials/required.html' %}{% endif %}</h3>
<div class="btn-radio-group" data-toggle="buttons">
<label class="btn btn-radio">


+ 7
- 7
edivorce/apps/core/tests/test_step_completeness.py View File

@ -133,18 +133,18 @@ class StepCompletenessTestCase(TestCase):
# Few required questions with one checking question with hidden question not shown
self.create_response('lived_in_bc_you', '11/11/1111')
self.assertEqual(self.check_completeness(step), True)
self.assertEqual(self.check_completeness(step), False)
# All required questions with one checking question with hidden question not shown
self.create_response('last_name_born_you', 'Jackson')
self.assertEqual(self.check_completeness(step), True)
self.assertEqual(self.check_completeness(step), False)
UserResponse.objects.filter(question_id='lived_in_bc_you').update(value="Moved to B.C. on")
self.assertEqual(self.check_completeness(step), False)
# All required questions with one checking question with hidden question
self.create_response('moved_to_bc_date_you', '12/12/1212')
self.assertEqual(self.check_completeness(step), True)
self.assertEqual(self.check_completeness(step), False)
# All required questions with two checking question with one hidden and one shown
self.create_response('any_other_name_you', 'NO')
@ -189,14 +189,14 @@ class StepCompletenessTestCase(TestCase):
self.create_response('last_name_born_spouse', 'Jackson')
self.assertEqual(self.check_completeness(step), False)
# All required questions with one checking question with hidden question
self.create_response('lived_in_bc_spouse', 'Since birth')
self.assertEqual(self.check_completeness(step), True)
# All required questions with one checking question with hidden question missing
UserResponse.objects.filter(question_id='any_other_name_spouse').update(value="YES")
self.assertEqual(self.check_completeness(step), False)
# All required questions with one checking question with hidden question
self.create_response('lived_in_bc_spouse', 'Since birth')
self.assertEqual(self.check_completeness(step), False)
# All required questions with two checking question with one hidden and one shown
self.create_response('other_name_spouse', '[["also known as","Smith","James","Jerry","Joseph"]]')
self.assertEqual(self.check_completeness(step), True)


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

@ -151,9 +151,11 @@ def _is_question_required(question, questions_dict, responses_by_key):
else:
return HIDDEN
elif target in questions_dict:
target_response = responses_by_key.get(target)
if target_response and _condition_met(target_response, reveal_response):
return REQUIRED
target_question_requirement = _is_question_required(target, questions_dict, responses_by_key)
if target_question_requirement == REQUIRED:
target_response = responses_by_key.get(target)
if target_response and _condition_met(target_response, reveal_response):
return REQUIRED
return HIDDEN
else:
raise KeyError(f"Invalid conditional target '{target}' for question '{question}'")


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

@ -242,7 +242,7 @@
"name": "Do you go by any other names?",
"description": "For step 2, Form 1 Claimant 1, Form 35 Claimant 1, Form 36 Claimant 1, Form 38 Claimant 1(sole), Form 38 Claimant 1, affidavit section(joint), Form 52 Claimant 1",
"summary_order": 23,
"required": ""
"required": "Required"
},
"model": "core.question",
"pk": "any_other_name_you"
@ -366,7 +366,7 @@
"name": "Does your spouse go by any other names?",
"description": "For step 3, Form 1 Claimant 2, Form 35 Claimant 2, Form 36 Claimant 2, Form 38 Claimant 2(sole), Form 38 Claimant 2, affidavit section(joint), Form 52 Claimant 2",
"summary_order": 35,
"required": ""
"required": "Required"
},
"model": "core.question",
"pk": "any_other_name_spouse"


Loading…
Cancel
Save