Browse Source

DIV-514

pull/160/head
Justin Johnson 8 years ago
parent
commit
0a09f15977
4 changed files with 25 additions and 5 deletions
  1. +1
    -1
      edivorce/apps/core/static/css/main.css
  2. +1
    -1
      edivorce/apps/core/static/css/main.css.map
  3. +22
    -2
      edivorce/apps/core/utils/user_response.py
  4. +1
    -1
      edivorce/apps/core/views/main.py

+ 1
- 1
edivorce/apps/core/static/css/main.css
File diff suppressed because it is too large
View File


+ 1
- 1
edivorce/apps/core/static/css/main.css.map
File diff suppressed because it is too large
View File


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

@ -15,8 +15,13 @@ def get_responses_from_db(bceid_user):
return responses_dict
def get_responses_from_db_grouped_by_steps(bceid_user):
""" Group questions and responses by steps they belong to """
def get_responses_from_db_grouped_by_steps(bceid_user, hide_failed_conditionals=False):
"""
Group questions and responses by steps to which they belong
`hide_failed_conditionals` goes through the responses after grouping and
tests their conditionality. If they fail, the response is blanked.
"""
married, married_questions, responses = __get_data(bceid_user)
responses_dict = {}
@ -39,6 +44,21 @@ def get_responses_from_db_grouped_by_steps(bceid_user):
'question__required': answer.question.required,
'question_id': answer.question.pk}]
# This was added for DIV-514, where the user entered a name change for
# their spouse but then said 'no', they won't be changing their name.
# Since we don't blank related answers, we need to hide it dynamically.
# This only works for questions in the same step.
if hide_failed_conditionals:
values = {q['question_id']: q['value'] for q in lst}
for q in lst:
if q['question__required'] != 'Conditional':
continue
target = q['question__conditional_target']
if target not in values:
continue
if q['question__reveal_response'] != values[target]:
q['value'] = ''
responses_dict[step] = lst
return responses_dict


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

@ -184,7 +184,7 @@ def question(request, step):
template = 'question/%02d_%s.html' % (template_step_order[step], step)
user, _ = __get_bceid_user(request)
responses_dict_by_step = get_responses_from_db_grouped_by_steps(user)
responses_dict_by_step = get_responses_from_db_grouped_by_steps(user, True)
if step == "review":
responses_dict = responses_dict_by_step


Loading…
Cancel
Save