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:
parent
08c1a967ba
commit
e4cbe892fc
@ -6,7 +6,8 @@ from sqlalchemy.ext.hybrid import hybrid_property
|
|||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
from werkzeug.datastructures import FileStorage
|
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):
|
class Status(Enum):
|
||||||
@ -33,6 +34,8 @@ class TaskOrder(Base, mixins.TimestampsMixin):
|
|||||||
signer_dod_id = Column(String)
|
signer_dod_id = Column(String)
|
||||||
signed_at = Column(DateTime)
|
signed_at = Column(DateTime)
|
||||||
|
|
||||||
|
clins = relationship("CLIN")
|
||||||
|
|
||||||
@hybrid_property
|
@hybrid_property
|
||||||
def pdf(self):
|
def pdf(self):
|
||||||
return self._pdf
|
return self._pdf
|
||||||
@ -83,9 +86,26 @@ class TaskOrder(Base, mixins.TimestampsMixin):
|
|||||||
return (self.end_date - date.today()).days
|
return (self.end_date - date.today()).days
|
||||||
|
|
||||||
@property
|
@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):
|
def budget(self):
|
||||||
# TODO: fix task order -- reimplement using CLINs
|
|
||||||
# Faked for display purposes
|
|
||||||
return 100000
|
return 100000
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
<div class="col totals-box">
|
<div class="col totals-box">
|
||||||
<div class="h4">Total obligated funds</div>
|
<div class="h4">Total obligated funds</div>
|
||||||
<div class="h3">$500,000</div>
|
<div class="h3">{{ task_order.total_obligated_funds | dollars }}</div>
|
||||||
<div>This is the funding allocated to cloud services. It may be 100% or a portion of the total task order budget.</div>
|
<div>This is the funding allocated to cloud services. It may be 100% or a portion of the total task order budget.</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="h4">Total contract amount</div>
|
<div class="h4">Total contract amount</div>
|
||||||
<div class="h3">{{ task_order.budget | dollars }}</div>
|
<div class="h3">{{ task_order.total_contract_amount | dollars }}</div>
|
||||||
<div>This is the value of all funds obligated for this contract, including -- but not limited to -- funds obligated for the cloud.</div>
|
<div>This is the value of all funds obligated for this contract, including -- but not limited to -- funds obligated for the cloud.</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user