From 51f1261db016efa0709ef6586c27d7f279a667ac Mon Sep 17 00:00:00 2001 From: graham-dds Date: Tue, 26 Nov 2019 11:17:25 -0500 Subject: [PATCH] Order CLINs on reporting page and refactor labels In order to more easily sort JEDI Clins for the obligated funds section, the JEDI CLIN enum values were used in the output dict instead of their verbose labels. And in order to bring the labels in line with designs, the JEDI CLIN labels were DRYed up in the translations file, which required making small changes in a few other places across the project. --- atst/domain/csp/reports.py | 9 ++++++--- atst/forms/data.py | 8 ++++---- templates/components/clin_fields.html | 8 ++++---- templates/portfolios/reports/obligated_funds.html | 2 +- translations.yaml | 12 ++++-------- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/atst/domain/csp/reports.py b/atst/domain/csp/reports.py index 683c1139..2d42fede 100644 --- a/atst/domain/csp/reports.py +++ b/atst/domain/csp/reports.py @@ -1,7 +1,7 @@ from itertools import groupby -from atst.utils.localization import translate import pendulum from decimal import Decimal +from collections import OrderedDict class ReportingInterface: @@ -295,13 +295,16 @@ class MockReportingProvider(ReportingInterface): portfolio.active_clins, lambda clin: clin.jedi_clin_type ): obligated_funds = sum(clin.obligated_amount for clin in clins) - return_dict[translate(f"JEDICLINType.{jedi_clin.value}")] = { + return_dict[jedi_clin.value] = { "obligated_funds": obligated_funds, "expended_funds": ( obligated_funds * Decimal(self.MOCK_PERCENT_EXPENDED_FUNDS) ), } - return return_dict + return OrderedDict( + # 0 index for dict item, -1 for last digit of 4 digit CLIN, e.g. 0001 + sorted(return_dict.items(), key=lambda clin: clin[0][-1]) + ) return {} def get_expired_task_orders(self, portfolio): diff --git a/atst/forms/data.py b/atst/forms/data.py index 9bf88cd7..7b1b4a40 100644 --- a/atst/forms/data.py +++ b/atst/forms/data.py @@ -117,8 +117,8 @@ ENV_ROLES = [(role.value, role.value) for role in CSPRole] + [ ] JEDI_CLIN_TYPES = [ - ("JEDI_CLIN_1", translate("forms.task_order.clin_01_label")), - ("JEDI_CLIN_2", translate("forms.task_order.clin_02_label")), - ("JEDI_CLIN_3", translate("forms.task_order.clin_03_label")), - ("JEDI_CLIN_4", translate("forms.task_order.clin_04_label")), + ("JEDI_CLIN_1", translate("JEDICLINType.JEDI_CLIN_1")), + ("JEDI_CLIN_2", translate("JEDICLINType.JEDI_CLIN_2")), + ("JEDI_CLIN_3", translate("JEDICLINType.JEDI_CLIN_3")), + ("JEDI_CLIN_4", translate("JEDICLINType.JEDI_CLIN_4")), ] diff --git a/templates/components/clin_fields.html b/templates/components/clin_fields.html index 6d79dc08..1117b89c 100644 --- a/templates/components/clin_fields.html +++ b/templates/components/clin_fields.html @@ -92,10 +92,10 @@ diff --git a/templates/portfolios/reports/obligated_funds.html b/templates/portfolios/reports/obligated_funds.html index a774c0f9..c8d6ff22 100644 --- a/templates/portfolios/reports/obligated_funds.html +++ b/templates/portfolios/reports/obligated_funds.html @@ -11,7 +11,7 @@ {% set remaining_funds = (funds["obligated_funds"] - funds["expended_funds"]) %}

- {{ JEDI_clin }} + {{ "JEDICLINType.{}".format(JEDI_clin) | translate }}

Total obligated amount: {{ funds["obligated_funds"] | dollars }}

diff --git a/translations.yaml b/translations.yaml index ea0ddca9..6bae67bf 100644 --- a/translations.yaml +++ b/translations.yaml @@ -182,10 +182,6 @@ forms: none: Not planning to migrate any applications not_sure: Not sure on_premise: 'Yes, migrating from an on-premise data center' - clin_01_label: 'IaaS/PaaS (IDIQ CLIN 0001)' - clin_02_label: 'IDIQ CLIN 0002' - clin_03_label: 'IDIQ CLIN 0003' - clin_04_label: 'IDIQ CLIN 0004' complexity: conus: CONUS access data_analytics: Data analytics @@ -519,10 +515,10 @@ task_orders: sign: digital_signature_description: I acknowledge that the uploaded task order contains the required KO signature. JEDICLINType: - JEDI_CLIN_1: 'Unclassified IaaS and PaaS (IDIQ CLIN 0001)' - JEDI_CLIN_2: 'Classified IaaS and PaaS (IDIQ CLIN 0002)' - JEDI_CLIN_3: 'Unclassified Cloud Support Package (IDIQ CLIN 0003)' - JEDI_CLIN_4: 'Classified Cloud Support Package (IDIQ CLIN 0004)' + JEDI_CLIN_1: 'IDIQ CLIN 0001 Unclassified IaaS/PaaS' + JEDI_CLIN_2: 'IDIQ CLIN 0002 Classified IaaS/PaaS' + JEDI_CLIN_3: 'IDIQ CLIN 0003 Unclassified Cloud Support Package' + JEDI_CLIN_4: 'IDIQ CLIN 0004 Classified Cloud Support Package' testing: example_string: Hello World example_with_variables: 'Hello, {name}!'