Funded Through on each portfolio screen

This commit is contained in:
Montana
2019-02-11 15:33:28 -05:00
parent aecab933b0
commit 6a8d4964d4
4 changed files with 48 additions and 2 deletions

View File

@@ -18,14 +18,17 @@ def dollars(value):
numberValue = 0
return "${:,.2f}".format(numberValue)
def justDollars(value):
raw = dollars(value)
return raw[:-3]
def justCents(value):
raw = dollars(value)
return raw[-3:]
def usPhone(number):
phone = re.sub(r"\D", "", number)
return "+1 ({}) {} - {}".format(phone[0:3], phone[3:6], phone[6:])

View File

@@ -1,4 +1,5 @@
from flask import Blueprint, request as http_request, g, render_template
from operator import attrgetter
portfolios_bp = Blueprint("portfolios", __name__)
@@ -31,4 +32,20 @@ def portfolio():
)
return False
return {"portfolio": portfolio, "permissions": Permissions, "user_can": user_can}
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
return {
"portfolio": portfolio,
"permissions": Permissions,
"user_can": user_can,
"funding_end_date": funding_end_date,
"funded": funded,
}