add updated CCPO request index columns

This commit is contained in:
dandds 2018-09-10 14:31:03 -04:00
parent 6bbc68031e
commit 1f64344ca3
4 changed files with 24 additions and 14 deletions

View File

@ -65,6 +65,13 @@ def renderList(value):
return app.jinja_env.filters["safe"]("<br>".join(value)) return app.jinja_env.filters["safe"]("<br>".join(value))
def formattedDate(value):
if value:
return value.strftime("%m/%d/%Y")
else:
return "-"
def register_filters(app): def register_filters(app):
app.jinja_env.filters["iconSvg"] = iconSvg app.jinja_env.filters["iconSvg"] = iconSvg
app.jinja_env.filters["dollars"] = dollars app.jinja_env.filters["dollars"] = dollars
@ -74,3 +81,4 @@ def register_filters(app):
app.jinja_env.filters["mixedContentToJson"] = mixedContentToJson app.jinja_env.filters["mixedContentToJson"] = mixedContentToJson
app.jinja_env.filters["findFilter"] = findFilter app.jinja_env.filters["findFilter"] = findFilter
app.jinja_env.filters["renderList"] = renderList app.jinja_env.filters["renderList"] = renderList
app.jinja_env.filters["formattedDate"] = formattedDate

View File

@ -1,7 +1,6 @@
from sqlalchemy import Column, func, ForeignKey from sqlalchemy import Column, func, ForeignKey
from sqlalchemy.types import DateTime from sqlalchemy.types import DateTime
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
import pendulum
from atst.models import Base from atst.models import Base
from atst.models.types import Id from atst.models.types import Id
@ -145,7 +144,7 @@ class Request(Base):
last_submission = first_or_none(_is_submission, reversed(self.status_events)) last_submission = first_or_none(_is_submission, reversed(self.status_events))
if last_submission: if last_submission:
return pendulum.instance(last_submission.time_created) return last_submission.time_created
return None return None
@property @property

View File

@ -64,11 +64,6 @@ class RequestsIndex(object):
"num_software_systems", 0 "num_software_systems", 0
) )
annual_usage = request.annual_spend annual_usage = request.annual_spend
last_submission_timestamp = (
request.last_submission_timestamp.format("M/DD/YYYY")
if request.last_submission_timestamp
else "-"
)
if viewing_role == "ccpo": if viewing_role == "ccpo":
edit_link = url_for("requests.approval", request_id=request.id) edit_link = url_for("requests.approval", request_id=request.id)
@ -89,11 +84,13 @@ class RequestsIndex(object):
"is_new": is_new, "is_new": is_new,
"status": request.status_displayname, "status": request.status_displayname,
"app_count": app_count, "app_count": app_count,
"last_submission_timestamp": last_submission_timestamp, "last_submission_timestamp": request.last_submission_timestamp,
"last_edited_timestamp": request.latest_revision.time_updated,
"full_name": request.creator.full_name, "full_name": request.creator.full_name,
"annual_usage": annual_usage, "annual_usage": annual_usage,
"edit_link": edit_link, "edit_link": edit_link,
"action_required": request.action_required_by == viewing_role, "action_required": request.action_required_by == viewing_role,
"dod_component": request.latest_revision.dod_component,
} }

View File

@ -105,26 +105,29 @@
<th scope="col">JEDI Cloud Request ID</th> <th scope="col">JEDI Cloud Request ID</th>
<th scope="col">Date Request Submitted</th> <th scope="col">Date Request Submitted</th>
{% if extended_view %} {% if extended_view %}
<th scope="col">Date Request Last Edited</th>
<th scope="col">Requester</th> <th scope="col">Requester</th>
<th scope="col">Reason Flagged</th>
{% endif %} {% endif %}
<th scope="col">Projected Annual Usage ($)</th> <th scope="col">Projected Annual Usage ($)</th>
<th scope="col">Request Status</th> <th scope="col">Request Status</th>
{% if extended_view %}
<th scope="col">DOD Component</th>
{% endif %}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for r in requests %} {% for r in requests %}
<tr> <tr>
<th scope="row"> <th scope="row">
<a class='icon-link icon-link--large' href="{{ r['edit_link'] }}">{{ r['order_id'] }}</a> <a class='icon-link icon-link--large' href="{{ r.edit_link }}">{{ r.order_id }}</a>
{% if r.action_required %}<span class="label label--info">Action Required</span>{% endif %} {% if r.action_required %}<span class="label label--info">Action Required</span>{% endif %}
</th> </th>
<td>{{ r.last_submission_timestamp }}</td> <td>{{ r.last_submission_timestamp | formattedDate }}</td>
{% if extended_view %} {% if extended_view %}
<td>{{ r['full_name'] }}</td> <td>{{ r.last_edited_timestamp | formattedDate }}</td>
<td></td> <td>{{ r.full_name }}</td>
{% endif %} {% endif %}
<td>{{ r['annual_usage'] | dollars }}</td> <td>{{ r.annual_usage | dollars }}</td>
<td> <td>
{% if r.status == 'Approved' %} {% if r.status == 'Approved' %}
<a href="{{ url_for('workspaces.workspace_projects', workspace_id=r.workspace_id) }}"> <a href="{{ url_for('workspaces.workspace_projects', workspace_id=r.workspace_id) }}">
@ -134,6 +137,9 @@
{{ r.status }} {{ r.status }}
{% endif %} {% endif %}
</td> </td>
{% if extended_view %}
<td>{{ r.dod_component }}</td>
{% endif %}
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>