From c2dbbc478450305be90f5f0c07aa14f38d654805 Mon Sep 17 00:00:00 2001 From: Montana Date: Tue, 12 Feb 2019 09:53:48 -0500 Subject: [PATCH] Fix tests --- atst/routes/portfolios/__init__.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/atst/routes/portfolios/__init__.py b/atst/routes/portfolios/__init__.py index 4e65bce1..e735064f 100644 --- a/atst/routes/portfolios/__init__.py +++ b/atst/routes/portfolios/__init__.py @@ -32,15 +32,19 @@ def portfolio(): ) return False - active_task_orders = [ - task_order for task_order in portfolio.task_orders if task_order.is_active - ] - funding_end_date = ( - sorted(active_task_orders, key=attrgetter("end_date"))[-1].end_date - if active_task_orders - else None - ) - funded = len(active_task_orders) > 1 + if not portfolio is None: + active_task_orders = [ + task_order for task_order in portfolio.task_orders if task_order.is_active + ] + funding_end_date = ( + sorted(active_task_orders, key=attrgetter("end_date"))[-1].end_date + if active_task_orders + else None + ) + funded = len(active_task_orders) > 1 + else: + funding_end_date = None + funded = None return { "portfolio": portfolio,