From 793ab247a50f9ae2ecdc173c77a9aac15a3a6000 Mon Sep 17 00:00:00 2001 From: ariannedee Date: Wed, 26 Aug 2020 12:52:29 -0700 Subject: [PATCH 1/2] Fix error in showing required fields when a section hasn't been started --- edivorce/apps/core/utils/step_completeness.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edivorce/apps/core/utils/step_completeness.py b/edivorce/apps/core/utils/step_completeness.py index 921adbfb..7a8c27c0 100644 --- a/edivorce/apps/core/utils/step_completeness.py +++ b/edivorce/apps/core/utils/step_completeness.py @@ -100,7 +100,7 @@ def get_error_dict(questions_by_step, step, substep=None): substep_questions = children_substep_question_mapping[substep] step_questions = list(filter(lambda question_dict: question_dict['question_id'] in substep_questions, step_questions)) - show_section_errors = not step_started(step_questions) and not is_complete(step_questions) + show_section_errors = step_started(step_questions) and not is_complete(step_questions) if show_section_errors or children_substep_and_step_started: for question_dict in step_questions: if question_dict['error']: From 9fc8474de21fd678c1aabc5cc1b80c1f36dc17c6 Mon Sep 17 00:00:00 2001 From: ariannedee Date: Wed, 26 Aug 2020 12:52:52 -0700 Subject: [PATCH 2/2] Trim whitespace so fields with only spaces are considered unfilled. --- edivorce/apps/core/static/js/functions.js | 2 +- edivorce/apps/core/utils/conditional_logic.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/edivorce/apps/core/static/js/functions.js b/edivorce/apps/core/static/js/functions.js index 462ff509..31f70cdc 100644 --- a/edivorce/apps/core/static/js/functions.js +++ b/edivorce/apps/core/static/js/functions.js @@ -289,7 +289,7 @@ var getValue = function(el, question){ $('#other_names_fields').find("input[type=text]").each(function () { // as per request, alias type will always be also known as for now // aliasType = $(this).val() === '' ? '' : $(this).siblings(".alias-type").val(); - value.push([aliasType, $(this).val()]); + value.push([aliasType, $(this).val().trim()]); }); return JSON.stringify(value); } diff --git a/edivorce/apps/core/utils/conditional_logic.py b/edivorce/apps/core/utils/conditional_logic.py index fb62f142..5ce0265e 100644 --- a/edivorce/apps/core/utils/conditional_logic.py +++ b/edivorce/apps/core/utils/conditional_logic.py @@ -130,7 +130,10 @@ def determine_missing_extraordinary_expenses(questions_dict): def get_cleaned_response_value(response): - ignore_values = [None, '', '[]', '[["",""]]', '[["also known as",""]]'] + if response is None: + return None + response = response.strip() + ignore_values = ['', '[]', '[["",""]]', '[["also known as",""]]'] if response not in ignore_values: return response return None