diff --git a/atst/filters.py b/atst/filters.py
index 6ecd6d1f..e889b300 100644
--- a/atst/filters.py
+++ b/atst/filters.py
@@ -50,6 +50,15 @@ def mixedContentToJson(value):
return app.jinja_env.filters["tojson"](value)
+def findFilter(value, filter_name, filter_args=[]):
+ if not filter_name:
+ return value
+ elif filter_name in app.jinja_env.filters:
+ return app.jinja_env.filters[filter_name](value, *filter_args)
+ else:
+ raise ValueError("filter name {} not found".format(filter_name))
+
+
def register_filters(app):
app.jinja_env.filters["iconSvg"] = iconSvg
app.jinja_env.filters["dollars"] = dollars
@@ -57,3 +66,4 @@ def register_filters(app):
app.jinja_env.filters["readableInteger"] = readableInteger
app.jinja_env.filters["getOptionLabel"] = getOptionLabel
app.jinja_env.filters["mixedContentToJson"] = mixedContentToJson
+ app.jinja_env.filters["findFilter"] = findFilter
diff --git a/templates/requests/_review.html b/templates/requests/_review.html
index 8d21d7f2..576f07fc 100644
--- a/templates/requests/_review.html
+++ b/templates/requests/_review.html
@@ -2,6 +2,20 @@
Response Required
{%- endmacro %}
+{% macro DefinitionReviewField(title, section, item_name, filter=None, filter_args=[]) -%}
+
+
{{ title }}
+
+ {% if data[section] and data[section][item_name] %}
+ {{ data[section][item_name] | findFilter(filter, filter_args) }}
+ {% else %}
+ {{ RequiredLabel() }}
+ {% endif %}
+
+
+{% endmacro %}
+
+
Details of Use
@@ -14,161 +28,51 @@
-
-
- DoD Component
- -
- {% if data['details_of_use']['dod_component'] %}
- {{ data['details_of_use']['dod_component'] | getOptionLabel(service_branches) }}
- {% else %}
- {{ RequiredLabel() }}
- {% endif %}
-
-
-
-
- JEDI Usage
- - {{ data['details_of_use']['jedi_usage'] or RequiredLabel() }}
-
+ {{ DefinitionReviewField("DoD Component", "details_of_use", "dod_component", filter="getOptionLabel", filter_args=[service_branches]) }}
-
-
- Number of software systems
- -
- {% if data['details_of_use']['num_software_systems'] %}
- {{ data['details_of_use']['num_software_systems'] | readableInteger }}
- {% else %}
- {{ RequiredLabel() }}
- {% endif %}
-
-
+ {{ DefinitionReviewField("JEDI Usage", "details_of_use", "jedi_usage") }}
-
-
- JEDI Migration
- - {{ data['details_of_use']['jedi_migration'] or RequiredLabel() }}
-
+ {{ DefinitionReviewField("Number of software systems", "details_of_use", "num_software_systems", filter="readableInteger") }}
+
+ {{ DefinitionReviewField("JEDI Migration", "details_of_use", "jedi_migration") }}
{% if data['details_of_use']['jedi_migration'] == 'yes' %}
-
-
- Rationalization of Software Systems
- - {{ data['details_of_use']['rationalization_software_systems'] or RequiredLabel() }}
-
-
-
-
- Technical Support Team
- - {{ data['details_of_use']['technical_support_team'] or RequiredLabel() }}
-
+ {{ DefinitionReviewField("Rationalization of Software Systems", "details_of_use", "rationalization_software_systems") }}
+ {{ DefinitionReviewField("Technical Support Team", "details_of_use", "technical_support_team") }}
{% if data['details_of_use']['technical_support_team'] == 'yes' %}
-
-
- Organization Providing Assistance
- -
- {% if data['details_of_use']['organization_providing_assistance'] %}
- {{ data['details_of_use']['organization_providing_assistance'] | getOptionLabel(assistance_org_types) }}
- {% else %}
- {{ RequiredLabel() }}
- {% endif %}
-
-
+ {{ DefinitionReviewField("Organization Providing Assistance", "details_of_use", "organization_providing_assistance", filter="getOptionLabel", filter_args=[assistance_org_types]) }}
{% endif %}
-
-
- Engineering Assessment
- - {{ data['details_of_use']['engineering_assessment'] or RequiredLabel() }}
-
+ {{ DefinitionReviewField("Engineering Assessment", "details_of_use", "engineering_assessment") }}
-
-
- Data Transfers
- -
- {% if data['details_of_use']['data_transfers'] %}
- {{ data['details_of_use']['data_transfers'] | getOptionLabel(data_transfer_amounts) }}
- {% else %}
- {{ RequiredLabel() }}
- {% endif %}
-
-
+ {{ DefinitionReviewField("Data Transfers", "details_of_use", "data_transfers", filter="getOptionLabel", filter_args=[data_transfer_amounts]) }}
-
-
- Expected Completion Date
- -
- {% if data['details_of_use']['expected_completion_date'] %}
- {{ data['details_of_use']['expected_completion_date'] | getOptionLabel(completion_date_ranges) }}
- {% else %}
- {{ RequiredLabel() }}
- {% endif %}
-
-
+ {{ DefinitionReviewField("Expected Completion Date", "details_of_use", "expected_completion_date", filter="getOptionLabel", filter_args=[completion_date_ranges]) }}
{% else %}
-
-
- Cloud Native
- - {{ data['details_of_use']['cloud_native'] or RequiredLabel() }}
-
+ {{ DefinitionReviewField("Cloud Native", "details_of_use", "cloud_native") }}
{% endif %}
-
-
- Estimated Monthly Spend
- -
- {% if data['details_of_use']['estimated_monthly_spend'] %}
- {{ data['details_of_use']['estimated_monthly_spend'] | dollars }}
- {% else %}
- {{ RequiredLabel() }}
- {% endif %}
-
-
+ {{ DefinitionReviewField("Estimated Monthly Spend", "details_of_use", "estimated_monthly_spend", filter="dollars") }}
{% if jedi_request and jedi_request.annual_spend > annual_spend_threshold %}
-
-
- Number of User Sessions
- -
- {% if data['details_of_use']['number_user_sessions'] %}
- {{ data['details_of_use']['number_user_sessions'] | readableInteger }}
- {% else %}
- {{ RequiredLabel() }}
- {% endif %}
-
-
+ {{ DefinitionReviewField("Number of User Sessions", "details_of_use", "number_user_sessions", filter="readableInteger") }}
-
-
- Average Daily Traffic (Number of Requests)
- -
- {% if data['details_of_use']['average_daily_traffic'] %}
- {{ data['details_of_use']['average_daily_traffic'] | readableInteger }}
- {% else %}
- {{ RequiredLabel() }}
- {% endif %}
-
-
+ {{ DefinitionReviewField("Average Daily Traffic (Number of Requests)", "details_of_use", "average_daily_traffic", filter="readableInteger") }}
+
+ {{ DefinitionReviewField("Average Daily Traffic (GB)", "details_of_use", "average_daily_traffic_gb", filter="readableInteger") }}
-
-
- Average Daily Traffic (GB)
- -
- {% if data['details_of_use']['average_daily_traffic_gb'] %}
- {{ data['details_of_use']['average_daily_traffic_gb'] | readableInteger }} GB
- {% else %}
- {{ RequiredLabel() }}
- {% endif %}
-
-
{% endif %}
-
-
- Total Spend
- -
- {% if data['details_of_use']['dollar_value'] %}
- {{ data['details_of_use']['dollar_value'] | dollars }}
- {% else %}
- {{ RequiredLabel() }}
- {% endif %}
-
-
+ {{ DefinitionReviewField("Total Spend", "details_of_use", "dollar_value", filter="dollars") }}
-
-
- Start Date
- - {{ data['details_of_use']['start_date'] or RequiredLabel() }}
-
+ {{ DefinitionReviewField("Start Date", "details_of_use", "start_date") }}
@@ -183,63 +87,21 @@
-
-
- First Name
- - {{ data['information_about_you']['fname_request'] or RequiredLabel() }}
-
+ {{ DefinitionReviewField("First Name", "information_about_you", "fname_request") }}
-
-
- Last Name
- - {{ data['information_about_you']['lname_request'] or RequiredLabel() }}
-
+ {{ DefinitionReviewField("Last Name", "information_about_you", "lname_request") }}
-
-
- Email Address
- - {{ data['information_about_you']['email_request'] or RequiredLabel() }}
-
+ {{ DefinitionReviewField("Email Address", "information_about_you", "email_request") }}
-
-
- Phone Number
- -
- {% if data['information_about_you']['phone_number'] %}
- {{ data['information_about_you']['phone_number'] | usPhone }}
- {% else %}
- {{ RequiredLabel() }}
- {% endif %}
-
-
+ {{ DefinitionReviewField("Phone Number", "information_about_you", "phone_number", filter="usPhone") }}
-
-
- Service Branch or Agency
- -
- {% if data['information_about_you']['service_branch'] %}
- {{ data['information_about_you']['service_branch'] | getOptionLabel(service_branches) }}
- {% else %}
- {{ RequiredLabel() }}
- {% endif %}
-
-
+ {{ DefinitionReviewField("Service Branch or Agency", "information_about_you", "service_branch", filter="getOptionLabel", filter_args=[service_branches]) }}
-
-
- Citizenship
- - {{ data['information_about_you']['citizenship'] or RequiredLabel() }}
-
+ {{ DefinitionReviewField("Citizenship", "information_about_you", "citizenship") }}
-
-
- Designation of Person
- -
- {% if data['information_about_you']['designation'] %}
- {{ data['information_about_you']['designation'] | capitalize }}
- {% else %}
- {{ RequiredLabel() }}
- {% endif %}
-
-
+ {{ DefinitionReviewField("Designation of Person", "information_about_you", "designation", filter="capitalize") }}
-
-
- Latest Information Assurance (IA) Training completion date
- - {{ data['information_about_you']['date_latest_training'] or RequiredLabel() }}
-
+ {{ DefinitionReviewField("Latest Information Assurance (IA) Training completion date", "information_about_you", "date_latest_training") }}
@@ -254,25 +116,13 @@
-
-
- POC First Name
- - {{ data['primary_poc']['fname_poc'] or RequiredLabel() }}
-
+ {{ DefinitionReviewField("POC First Name", "primary_poc", "fname_poc") }}
-
-
- POC Last Name
- - {{ data['primary_poc']['lname_poc'] or RequiredLabel() }}
-
+ {{ DefinitionReviewField("POC Last Name", "primary_poc", "lname_poc") }}
-
-
- POC Email Address
- - {{ data['primary_poc']['email_poc'] or RequiredLabel() }}
-
+ {{ DefinitionReviewField("POC Email Address", "primary_poc", "email_poc") }}
-
-
- DOD ID
- - {{ data['primary_poc']['dodid_poc'] or RequiredLabel() }}
-
+ {{ DefinitionReviewField("DOD ID", "primary_poc", "dodid_poc") }}