Browse Source

Add children substep progress icons

pull/170/head
ariannedee 5 years ago
parent
commit
d109e5d025
6 changed files with 58 additions and 33 deletions
  1. +1
    -1
      edivorce/apps/core/static/css/main.css
  2. +21
    -15
      edivorce/apps/core/static/css/main.scss
  3. +6
    -1
      edivorce/apps/core/templates/partials/progress.html
  4. +1
    -1
      edivorce/apps/core/templates/partials/progress_icon.html
  5. +0
    -1
      edivorce/apps/core/utils/question_step_mapping.py
  6. +29
    -14
      edivorce/apps/core/utils/step_completeness.py

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


+ 21
- 15
edivorce/apps/core/static/css/main.scss View File

@ -1658,19 +1658,6 @@ textarea {
}
}
.progress-status {
width: 28px;
text-align: right;
i {
float: right;
}
}
i.incomplete, i.skipped {
color: $color-red-dark;
}
i,
span {
color: $color-blue-dark;
@ -1697,13 +1684,28 @@ textarea {
}
}
.progress-status {
width: 28px;
text-align: right;
i {
float: right;
&.incomplete, &.skipped {
color: $color-red-dark;
}
&.complete {
color: $color-green-dark;
}
}
}
.progress-sub-menu {
list-style-type: none;
li {
display:inline-block;
padding: 5px 10px 5px 22px;
padding: 5px 24px 5px 22px;
border-left:2px solid $brand-gold;
width: 100%;
}
@ -1736,7 +1738,11 @@ textarea {
color: $brand-gold;
text-decoration: none;
font-weight: 700;
}
&.active {
border-bottom: 1px solid $brand-gold;
}
}
&.active {
text-decoration: none;


+ 6
- 1
edivorce/apps/core/templates/partials/progress.html View File

@ -42,31 +42,36 @@
{% include "partials/progress_icon.html" with step_status_string=step_status.your_children%}
</a>
<ul class="collapse {% if active_page == 'children' %} in {% endif %} progress-sub-menu" id="children_nav">
<ul class="collapse {% if active_page == 'children' %}in {% endif %}progress-sub-menu" id="children_nav">
<li>
<a href="{% url 'question_steps' 'children' 'your_children'%}" class="progress-sub-question {% if sub_step == 'your_children' %} active {% endif %}">
<span class="progress-content">Children details</span>
</a>
{% include "partials/progress_icon.html" with step_status_string=step_status.children__your_children %}
</li>
<li>
<a href="{% url 'question_steps' 'children' 'income_expenses'%}" class="progress-sub-question {% if sub_step == 'income_expenses' %} active {% endif %}">
<span class="progress-content">Income & expenses</span>
</a>
{% include "partials/progress_icon.html" with step_status_string=step_status.children__income_expenses %}
</li>
<li>
<a href="{% url 'question_steps' 'children' 'facts'%}" class="progress-sub-question {% if sub_step == 'facts' %} active {% endif %}">
<span class="progress-content">Payor & Fact sheets</span>
</a>
{% include "partials/progress_icon.html" with step_status_string=step_status.children__facts %}
</li>
<li>
<a href="{% url 'question_steps' 'children' 'payor_medical'%}" class="progress-sub-question {% if sub_step == 'payor_medical' %} active {% endif %}">
<span class="progress-content">Medical & other expenses</span>
</a>
{% include "partials/progress_icon.html" with step_status_string=step_status.children__payor_medical %}
</li>
<li>
<a href="{% url 'question_steps' 'children' 'what_for'%}" class="progress-sub-question {% if sub_step == 'what_for' %} active {% endif %}">
<span class="progress-content">What are you asking for</span>
</a>
{% include "partials/progress_icon.html" with step_status_string=step_status.children__what_for %}
</li>
</ul>


+ 1
- 1
edivorce/apps/core/templates/partials/progress_icon.html View File

@ -3,7 +3,7 @@
{{ step_status_string }}
{% endif %}
{% if step_status_string == 'Started' %}<i class="fa fa-adjust incomplete" aria-hidden="true"></i>
{% elif step_status_string == 'Completed' %}<i class="fa fa-check" aria-hidden="true"></i>
{% elif step_status_string == 'Completed' %}<i class="fa fa-check complete" aria-hidden="true"></i>
{% elif step_status_string == 'Skipped' %}<i class="fa fa-circle-o skipped" aria-hidden="true"></i>
{% endif %}
</span>

+ 0
- 1
edivorce/apps/core/utils/question_step_mapping.py View File

@ -109,7 +109,6 @@ children_substep_question_mapping = {
'child_support_arrears_amount',
},
'what_for': {
'child_support_in_order',
'order_monthly_child_support_amount',
'child_support_in_order_reason',
'claimants_agree_to_child_support_amount',


+ 29
- 14
edivorce/apps/core/utils/step_completeness.py View File

@ -35,28 +35,43 @@ def evaluate_numeric_condition(target, reveal_response):
def get_step_completeness(questions_by_step):
"""
Accepts a dictionary of {step: [{question__name, question_id, value, error}]} <-- from get_step_responses
Returns {step: status}, {step: [missing_question_key]}
Returns {step: status, substep: status}
"""
status_dict = {}
has_responses = False
reversed_steps = list(question_step_mapping.keys())[::-1]
for step in reversed_steps:
questions_dict = questions_by_step[step]
if not step_started(questions_dict):
if not has_responses:
status_dict[step] = "Not started"
else:
status_dict[step] = "Skipped"
else:
has_responses = True
complete = is_complete(questions_dict)
if complete:
status_dict[step] = "Completed"
else:
status_dict[step] = "Started"
question_dicts = questions_by_step[step]
status, has_responses = _get_step_status(question_dicts, has_responses)
status_dict[step] = status
has_responses = False
reversed_substeps = list(children_substep_question_mapping.keys())[::-1]
for substep in reversed_substeps:
substep_questions = children_substep_question_mapping[substep]
question_dicts = [question_data for question_data in questions_by_step['your_children'] if question_data['question_id'] in substep_questions]
status, has_responses = _get_step_status(question_dicts, has_responses)
status_dict[f'children__{substep}'] = status
return status_dict
def _get_step_status(question_dicts, has_responses):
if not step_started(question_dicts):
if not has_responses:
status = "Not started"
else:
status = "Skipped"
else:
has_responses = True
complete = is_complete(question_dicts)
if complete:
status = "Completed"
else:
status = "Started"
return status, has_responses
def step_started(question_list):
for question_dict in question_list:
if get_cleaned_response_value(question_dict['value']):


Loading…
Cancel
Save