From 2236faf6a9213d7b49644942f0301a8645f124b6 Mon Sep 17 00:00:00 2001 From: Charles Shin Date: Tue, 28 Mar 2017 11:55:01 -0700 Subject: [PATCH] Fixed DIV-446, your marriage defaults to started bug --- .../apps/core/templatetags/summary_format.py | 16 +++++++++++----- .../apps/core/utils/question_step_mapping.py | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/edivorce/apps/core/templatetags/summary_format.py b/edivorce/apps/core/templatetags/summary_format.py index b852c795..cfc4fb72 100644 --- a/edivorce/apps/core/templatetags/summary_format.py +++ b/edivorce/apps/core/templatetags/summary_format.py @@ -115,8 +115,8 @@ def combine_address(source): return ''.join(tags) -@register.simple_tag -def marriage_tag(source): +@register.simple_tag(takes_context=True) +def marriage_tag(context, source): """ Reformat your_marriage step Also show/hide optional questions @@ -137,14 +137,20 @@ def marriage_tag(source): marital_status_spouse = "" marital_status_spouse_q = "" + # get married_marriage_like value to check if legally married or not + for question in context.get('prequalification', ''): + if question['question_id'] == 'married_marriage_like' and question['value'] == 'Legally married': + show_all = True + break + elif question['question_id'] == 'married_marriage_like': + break + for item in source: q_id = item['question_id'] value = item['value'] q_name = item['question__name'] - if q_id == 'married_marriage_like' and value == 'Legally married': - show_all = True - elif q_id == 'when_were_you_married': + if q_id == 'when_were_you_married': married_date_q = q_name married_date = value elif q_id == 'when_were_you_live_married_like': diff --git a/edivorce/apps/core/utils/question_step_mapping.py b/edivorce/apps/core/utils/question_step_mapping.py index 6500b052..6fff397d 100644 --- a/edivorce/apps/core/utils/question_step_mapping.py +++ b/edivorce/apps/core/utils/question_step_mapping.py @@ -15,7 +15,7 @@ question_step_mapping = {'prequalification': ['married_marriage_like', 'lived_in 'occupation_spouse'], 'your_marriage': ['when_were_you_married', 'where_were_you_married_city', 'where_were_you_married_prov', 'where_were_you_married_country', 'where_were_you_married_other_country', 'marital_status_before_you', - 'marital_status_before_spouse', 'when_were_you_live_married_like', 'married_marriage_like'], + 'marital_status_before_spouse', 'when_were_you_live_married_like'], 'your_separation': ['no_reconciliation_possible', 'no_collusion',], 'spousal_support': ['spouse_support_details', 'spouse_support_act',], 'property_and_debt': ['deal_with_property_debt', 'how_to_divide_property_debt', 'other_property_claims', 'want_other_property_claims'],