From fd849a801acdd27063c0dbb14272020e392f13f5 Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Fri, 8 Feb 2019 10:16:51 -0500 Subject: [PATCH] Only include active Task Orders in portfolio budget --- atst/models/task_order.py | 5 ++++- templates/portfolios/header.html | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/atst/models/task_order.py b/atst/models/task_order.py index 170e3be4..a139a34f 100644 --- a/atst/models/task_order.py +++ b/atst/models/task_order.py @@ -106,13 +106,16 @@ class TaskOrder(Base, mixins.TimestampsMixin): @property def is_submitted(self): - return ( self.number is not None and self.start_date is not None and self.end_date is not None ) + @property + def is_active(self): + return self.status == Status.ACTIVE + @property def status(self): if self.is_submitted: diff --git a/templates/portfolios/header.html b/templates/portfolios/header.html index 9bbe4132..5e3bd508 100644 --- a/templates/portfolios/header.html +++ b/templates/portfolios/header.html @@ -20,7 +20,7 @@ {{ Icon('info') }} - {{ portfolio.task_orders | sum(attribute='budget') | dollars }} + {{ portfolio.task_orders | selectattr('is_active') | sum(attribute='budget') | dollars }}