diff --git a/atst/models/task_order.py b/atst/models/task_order.py index 525c71ed..049b7d85 100644 --- a/atst/models/task_order.py +++ b/atst/models/task_order.py @@ -6,7 +6,8 @@ from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy.orm import relationship from werkzeug.datastructures import FileStorage -from atst.models import Attachment, Base, types, mixins +from atst.models import Attachment, Base, mixins, types +from atst.models.clin import JEDICLINType class Status(Enum): @@ -33,6 +34,8 @@ class TaskOrder(Base, mixins.TimestampsMixin): signer_dod_id = Column(String) signed_at = Column(DateTime) + clins = relationship("CLIN") + @hybrid_property def pdf(self): return self._pdf @@ -83,9 +86,26 @@ class TaskOrder(Base, mixins.TimestampsMixin): return (self.end_date - date.today()).days @property + def total_obligated_funds(self): + total = 0 + for clin in self.clins: + if clin.jedi_clin_type in [ + JEDICLINType.JEDI_CLIN_1, + JEDICLINType.JEDI_CLIN_3, + ]: + total += clin.obligated_amount + return total + + @property + def total_contract_amount(self): + total = 0 + for clin in self.clins: + total += clin.obligated_amount + return total + + @property + # TODO delete when we delete task_order_review flow def budget(self): - # TODO: fix task order -- reimplement using CLINs - # Faked for display purposes return 100000 @property diff --git a/templates/components/totals_box.html b/templates/components/totals_box.html index 08d47d63..18afeedf 100644 --- a/templates/components/totals_box.html +++ b/templates/components/totals_box.html @@ -2,13 +2,13 @@
Total obligated funds
-
$500,000
+
{{ task_order.total_obligated_funds | dollars }}
This is the funding allocated to cloud services. It may be 100% or a portion of the total task order budget.

Total contract amount
-
{{ task_order.budget | dollars }}
+
{{ task_order.total_contract_amount | dollars }}
This is the value of all funds obligated for this contract, including -- but not limited to -- funds obligated for the cloud.