display alert on requests index page when requests are pending CCPO approval

This commit is contained in:
dandds 2018-08-13 10:22:35 -04:00
parent 654f9231b5
commit 37bb0c5d30
3 changed files with 26 additions and 7 deletions

View File

@ -9,8 +9,10 @@ def map_request(request):
time_created = pendulum.instance(request.time_created) time_created = pendulum.instance(request.time_created)
is_new = time_created.add(days=1) > pendulum.now() is_new = time_created.add(days=1) > pendulum.now()
app_count = request.body.get("details_of_use", {}).get("num_software_systems", 0) app_count = request.body.get("details_of_use", {}).get("num_software_systems", 0)
update_url = url_for('requests.requests_form_update', screen=1, request_id=request.id) update_url = url_for(
verify_url = url_for('requests.financial_verification', request_id=request.id) "requests.requests_form_update", screen=1, request_id=request.id
)
verify_url = url_for("requests.financial_verification", request_id=request.id)
return { return {
"order_id": request.id, "order_id": request.id,
@ -19,7 +21,9 @@ def map_request(request):
"app_count": app_count, "app_count": app_count,
"date": time_created.format("M/DD/YYYY"), "date": time_created.format("M/DD/YYYY"),
"full_name": request.creator.full_name, "full_name": request.creator.full_name,
"edit_link": verify_url if Requests.is_pending_financial_verification(request) else update_url "edit_link": verify_url if Requests.is_pending_financial_verification(
request
) else update_url,
} }
@ -33,6 +37,15 @@ def requests_index():
mapped_requests = [map_request(r) for r in requests] mapped_requests = [map_request(r) for r in requests]
pending_fv = any(Requests.is_pending_financial_verification(r) for r in requests) pending_fv_count = [
True for r in requests if Requests.is_pending_financial_verification(r)
]
pending_fv = len(pending_fv_count) > 1
pending_ccpo = len(pending_fv_count) != len(mapped_requests)
return render_template("requests.html", requests=mapped_requests, pending_financial_verification=pending_fv) return render_template(
"requests.html",
requests=mapped_requests,
pending_financial_verification=pending_fv,
pending_ccpo_approval=pending_ccpo,
)

View File

@ -42,6 +42,12 @@
{% endif %} {% endif %}
{% if pending_ccpo_approval %}
{{ Alert('Request submitted. Approval pending.', fragment="fragments/pending_ccpo_approval_alert.html") }}
{% endif %}
<div class="col col--grow"> <div class="col col--grow">
<form class='search-bar'> <form class='search-bar'>

View File

@ -21,7 +21,7 @@ def test_submit_reviewed_request(monkeypatch, client, user_session):
follow_redirects=False, follow_redirects=False,
) )
assert "/requests" in response.headers["Location"] assert "/requests" in response.headers["Location"]
assert "modal" not in response.headers["Location"] assert "modal=pendingCCPOApproval" in response.headers["Location"]
def test_submit_autoapproved_reviewed_request(monkeypatch, client, user_session): def test_submit_autoapproved_reviewed_request(monkeypatch, client, user_session):
@ -35,4 +35,4 @@ def test_submit_autoapproved_reviewed_request(monkeypatch, client, user_session)
data="", data="",
follow_redirects=False, follow_redirects=False,
) )
assert "/requests?modal=" in response.headers["Location"] assert "/requests?modal=pendingFinancialVerification" in response.headers["Location"]