diff --git a/atst/routes/portfolios/index.py b/atst/routes/portfolios/index.py index 647d68be..e3815cdc 100644 --- a/atst/routes/portfolios/index.py +++ b/atst/routes/portfolios/index.py @@ -62,9 +62,11 @@ def portfolio_reports(portfolio_id): prev_month = current_month - timedelta(days=28) two_months_ago = prev_month - timedelta(days=28) - expiration_date = ( - portfolio.legacy_task_order and portfolio.legacy_task_order.expiration_date + task_order = next( + (task_order for task_order in portfolio.task_orders if task_order.is_active), + None, ) + expiration_date = task_order and task_order.end_date if expiration_date: remaining_difference = expiration_date - today remaining_days = remaining_difference.days @@ -77,7 +79,7 @@ def portfolio_reports(portfolio_id): portfolio_totals=Reports.portfolio_totals(portfolio), monthly_totals=Reports.monthly_totals(portfolio), jedi_request=portfolio.request, - legacy_task_order=portfolio.legacy_task_order, + task_order=task_order, current_month=current_month, prev_month=prev_month, two_months_ago=two_months_ago, diff --git a/templates/portfolios/reports/index.html b/templates/portfolios/reports/index.html index 7e6128d7..07b43348 100644 --- a/templates/portfolios/reports/index.html +++ b/templates/portfolios/reports/index.html @@ -53,7 +53,7 @@