Use clin values to render budget information
- creates a relationship `clins` on task order model - two properties on task order model to calculate budget amounts
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user