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:
@@ -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):
|
||||
|
@@ -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")),
|
||||
]
|
||||
|
Reference in New Issue
Block a user