Move calc of a portfolio's obligated funds to prop

Add a property on the portfolio model to calculate the total
obligated funds for a portfolio. This replaces a one-off calculation
in a view function, and sets up functionality for future access
This commit is contained in:
graham-dds
2020-02-05 15:04:28 -05:00
parent 2f1c57aef4
commit 55736b723e
2 changed files with 8 additions and 8 deletions

View File

@@ -89,6 +89,12 @@ class Portfolio(
def active_task_orders(self):
return [task_order for task_order in self.task_orders if task_order.is_active]
@property
def total_obligated_funds(self):
return sum(
(task_order.total_obligated_funds for task_order in self.active_task_orders)
)
@property
def funding_duration(self):
"""