Pass active task order to reports page instead of legacy task order

This commit is contained in:
Patrick Smith 2019-02-09 14:15:30 -05:00
parent 288d207386
commit 51687dabff
2 changed files with 6 additions and 4 deletions

View File

@ -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,

View File

@ -53,7 +53,7 @@
<h2 class='to-summary__heading'>Task Order</h2>
<dl class='to-summary__to-number'>
<dt class='usa-sr-only'>Task Order Number</dt>
<dd>{{ legacy_task_order.number }}</dd>
<dd>{{ task_order.number }}</dd>
</dl>
</div>