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.
This commit is contained in:
graham-dds 2019-11-26 11:17:25 -05:00
parent fa9986f9bf
commit 51f1261db0
5 changed files with 19 additions and 20 deletions

View File

@ -1,7 +1,7 @@
from itertools import groupby from itertools import groupby
from atst.utils.localization import translate
import pendulum import pendulum
from decimal import Decimal from decimal import Decimal
from collections import OrderedDict
class ReportingInterface: class ReportingInterface:
@ -295,13 +295,16 @@ class MockReportingProvider(ReportingInterface):
portfolio.active_clins, lambda clin: clin.jedi_clin_type portfolio.active_clins, lambda clin: clin.jedi_clin_type
): ):
obligated_funds = sum(clin.obligated_amount for clin in clins) 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, "obligated_funds": obligated_funds,
"expended_funds": ( "expended_funds": (
obligated_funds * Decimal(self.MOCK_PERCENT_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 {} return {}
def get_expired_task_orders(self, portfolio): def get_expired_task_orders(self, portfolio):

View File

@ -117,8 +117,8 @@ ENV_ROLES = [(role.value, role.value) for role in CSPRole] + [
] ]
JEDI_CLIN_TYPES = [ JEDI_CLIN_TYPES = [
("JEDI_CLIN_1", translate("forms.task_order.clin_01_label")), ("JEDI_CLIN_1", translate("JEDICLINType.JEDI_CLIN_1")),
("JEDI_CLIN_2", translate("forms.task_order.clin_02_label")), ("JEDI_CLIN_2", translate("JEDICLINType.JEDI_CLIN_2")),
("JEDI_CLIN_3", translate("forms.task_order.clin_03_label")), ("JEDI_CLIN_3", translate("JEDICLINType.JEDI_CLIN_3")),
("JEDI_CLIN_4", translate("forms.task_order.clin_04_label")), ("JEDI_CLIN_4", translate("JEDICLINType.JEDI_CLIN_4")),
] ]

View File

@ -92,10 +92,10 @@
</div> </div>
</legend> </legend>
<select :id='name' :name='name'> <select :id='name' :name='name'>
<option value="JEDI_CLIN_1">{{ "forms.task_order.clin_01_label" | translate }}</option> <option value="JEDI_CLIN_1">{{ "JEDICLINType.JEDI_CLIN_1" | translate }}</option>
<option value="JEDI_CLIN_2">{{ "forms.task_order.clin_02_label" | translate }}</option> <option value="JEDI_CLIN_2">{{ "JEDICLINType.JEDI_CLIN_2" | translate }}</option>
<option value="JEDI_CLIN_3">{{ "forms.task_order.clin_03_label" | translate }}</option> <option value="JEDI_CLIN_3">{{ "JEDICLINType.JEDI_CLIN_3" | translate }}</option>
<option value="JEDI_CLIN_4">{{ "forms.task_order.clin_04_label" | translate }}</option> <option value="JEDI_CLIN_4">{{ "JEDICLINType.JEDI_CLIN_4" | translate }}</option>
</select> </select>
</fieldset> </fieldset>
</div> </div>

View File

@ -11,7 +11,7 @@
{% set remaining_funds = (funds["obligated_funds"] - funds["expended_funds"]) %} {% set remaining_funds = (funds["obligated_funds"] - funds["expended_funds"]) %}
<div class="jedi-clin-funding__clin-wrapper"> <div class="jedi-clin-funding__clin-wrapper">
<h3 class="h5 jedi-clin-funding__header"> <h3 class="h5 jedi-clin-funding__header">
{{ JEDI_clin }} {{ "JEDICLINType.{}".format(JEDI_clin) | translate }}
</h3> </h3>
<p class="jedi-clin-funding__subheader">Total obligated amount: {{ funds["obligated_funds"] | dollars }}</p> <p class="jedi-clin-funding__subheader">Total obligated amount: {{ funds["obligated_funds"] | dollars }}</p>
<meter class="jedi-clin-funding__meter" value='{{remaining_funds}}' min='0' max='{{ funds["obligated_funds"] }}' title='{{ JEDI_clin }}'> <meter class="jedi-clin-funding__meter" value='{{remaining_funds}}' min='0' max='{{ funds["obligated_funds"] }}' title='{{ JEDI_clin }}'>

View File

@ -182,10 +182,6 @@ forms:
none: Not planning to migrate any applications none: Not planning to migrate any applications
not_sure: Not sure not_sure: Not sure
on_premise: 'Yes, migrating from an on-premise data center' 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: complexity:
conus: CONUS access conus: CONUS access
data_analytics: Data analytics data_analytics: Data analytics
@ -519,10 +515,10 @@ task_orders:
sign: sign:
digital_signature_description: I acknowledge that the uploaded task order contains the required KO signature. digital_signature_description: I acknowledge that the uploaded task order contains the required KO signature.
JEDICLINType: JEDICLINType:
JEDI_CLIN_1: 'Unclassified IaaS and PaaS (IDIQ CLIN 0001)' JEDI_CLIN_1: 'IDIQ CLIN 0001 Unclassified IaaS/PaaS'
JEDI_CLIN_2: 'Classified IaaS and PaaS (IDIQ CLIN 0002)' JEDI_CLIN_2: 'IDIQ CLIN 0002 Classified IaaS/PaaS'
JEDI_CLIN_3: 'Unclassified Cloud Support Package (IDIQ CLIN 0003)' JEDI_CLIN_3: 'IDIQ CLIN 0003 Unclassified Cloud Support Package'
JEDI_CLIN_4: 'Classified Cloud Support Package (IDIQ CLIN 0004)' JEDI_CLIN_4: 'IDIQ CLIN 0004 Classified Cloud Support Package'
testing: testing:
example_string: Hello World example_string: Hello World
example_with_variables: 'Hello, {name}!' example_with_variables: 'Hello, {name}!'