diff --git a/edivorce/apps/core/templates/question/01_orders.html b/edivorce/apps/core/templates/question/01_orders.html index 1351d088..d3956c7f 100644 --- a/edivorce/apps/core/templates/question/01_orders.html +++ b/edivorce/apps/core/templates/question/01_orders.html @@ -29,12 +29,17 @@ asked to provide details for each request.
+ You must select this option in order to complete a divorce using this tool. +
+ {% endif %}Divorce is the end of a legal marriage. To get a divorce, you must go through a legal process and get a court order that says the diff --git a/edivorce/apps/core/tests/test_step_completeness.py b/edivorce/apps/core/tests/test_step_completeness.py index b1e46d5f..a668ea21 100644 --- a/edivorce/apps/core/tests/test_step_completeness.py +++ b/edivorce/apps/core/tests/test_step_completeness.py @@ -26,7 +26,9 @@ class StepCompletenessTestCase(TestCase): return step_completeness[step] def create_response(self, question, value): - UserResponse.objects.create(bceid_user=self.user, question=Question.objects.get(key=question), value=value) + response, _ = UserResponse.objects.get_or_create(bceid_user=self.user, question_id=question) + response.value = value + response.save() def test_prequalification(self): step = 'prequalification' @@ -97,14 +99,19 @@ class StepCompletenessTestCase(TestCase): self.assertEqual(self.check_completeness(step), False) self.assertEqual(self.check_step_status(step), Status.NOT_STARTED) - # All required question - self.create_response('want_which_orders', '["nothing"]') - self.assertEqual(self.check_completeness(step), True) - self.assertEqual(self.check_step_status(step), Status.COMPLETED) + # Empty response + self.create_response('want_which_orders', '[]') + self.assertEqual(self.check_completeness(step), False) + self.assertEqual(self.check_step_status(step), Status.NOT_STARTED) - # Put empty response - UserResponse.objects.filter(question_id='want_which_orders').update(value="[]") + # Divorce order is required + self.create_response('want_which_orders', '["Child support"]') self.assertEqual(self.check_completeness(step), False) + self.assertEqual(self.check_step_status(step), Status.STARTED) + + self.create_response('want_which_orders', '["A legal end to the marriage"]') + self.assertEqual(self.check_completeness(step), True) + self.assertEqual(self.check_step_status(step), Status.COMPLETED) def test_your_info(self): step = 'your_information' diff --git a/edivorce/apps/core/utils/user_response.py b/edivorce/apps/core/utils/user_response.py index e1016c34..1cfa700c 100644 --- a/edivorce/apps/core/utils/user_response.py +++ b/edivorce/apps/core/utils/user_response.py @@ -106,6 +106,8 @@ def _get_question_details(question, questions_dict, responses_by_key): if response: value = get_cleaned_response_value(response) error = required and not value + if not error: + error = _other_errors(question, value) else: value = None error = None @@ -118,6 +120,12 @@ def _get_question_details(question, questions_dict, responses_by_key): return details +def _other_errors(question, value): + if question == 'want_which_orders' and 'A legal end to the marriage' not in value: + return True + return False + + def _is_question_required(question, questions_dict, responses_by_key): """ returns REQUIRED, HIDDEN, or OPTIONAL