Skip to content

Commit

Permalink
task/wp-373-admin-submitter-entity-name (#243)
Browse files Browse the repository at this point in the history
Co-authored-by: edmondsgarrett <[email protected]>
  • Loading branch information
sophia-massie and edmondsgarrett authored Nov 9, 2023
1 parent c5a13e0 commit ddfde91
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h1>View Submissions</h1>
{% for r in page %}
<tr>
<td>{{r.received_timestamp}}</td>
<td>{{r.org_name}}</td>
<td>{{r.entity_name}}</td>
<td colspan="2">{{r.file_name}}</td>
<td>{{r.outcome}}</td>
<td>{{r.status}}</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ <h4>Logs</h4>
<dl class="c-data-list--is-vert c-data-list--is-wide">
<dt class="c-data-list__key">Log ID</dt>
<dd class="c-data-list__value">{{log.log_id}}</dd>
<dt class="c-data-list__key">Organization</dt>
<dd class="c-data-list__value">{{r.org_name}}</dd>
<dt class="c-data-list__key">Entity Organization</dt>
<dd class="c-data-list__value">{{r.entity_name}}</dd>
<dt class="c-data-list__key">File Type</dt>
<dd class="c-data-list__value">{{log.file_type_name}}</dd>
<dt class="c-data-list__key">Validation Suite</dt>
Expand Down
3 changes: 2 additions & 1 deletion apcd-cms/src/apps/admin_submissions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def getDate(row):
# on the current page using offset and limit
for s in submission_content[offset:offset + limit]:
s['status'] = title_case(s['status'])
s['entity_name'] = title_case(s['entity_name'])
s['outcome'] = title_case(s['outcome'])
s['received_timestamp'] = parser.parse(s['received_timestamp']) if s['received_timestamp'] else None
s['updated_at'] = parser.parse(s['updated_at']) if s['updated_at'] else None
Expand All @@ -63,7 +64,7 @@ def getDate(row):
'outcome': title_case(t['outcome'])
} for t in (s['view_modal_content'] or [])]

context['header'] = ['Received', 'Organization', 'File Name', ' ', 'Outcome', 'Status', 'Last Updated', 'Actions']
context['header'] = ['Received', 'Entity Organization', 'File Name', ' ', 'Outcome', 'Status', 'Last Updated', 'Actions']
context['filter_options'] = ['All', 'In Process', 'Complete']
context['sort_options'] = {'newDate': 'Newest Received', 'oldDate': 'Oldest Received'}

Expand Down
43 changes: 2 additions & 41 deletions apcd-cms/src/apps/utils/apcd_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -1020,44 +1020,6 @@ def get_user_submissions_and_logs(user):
if conn is not None:
conn.close()


def get_all_submissions():
cur = None
conn = None
try:
conn = psycopg2.connect(
host=APCD_DB['host'],
dbname=APCD_DB['database'],
user=APCD_DB['user'],
password=APCD_DB['password'],
port=APCD_DB['port'],
sslmode='require'
)
query = """
SELECT
submissions.submission_id,
submissions.apcd_id,
submissions.submitter_id,
submissions.zip_file_name,
submissions.status,
submissions.outcome,
submissions.received_timestamp,
submissions.updated_at,
apcd_orgs.official_name
FROM submissions
JOIN apcd_orgs
ON submissions.apcd_id = apcd_orgs.apcd_id
ORDER BY submissions.received_timestamp DESC
"""
cur = conn.cursor()
cur.execute(query)
return cur.fetchall()
finally:
if cur is not None:
cur.close()
if conn is not None:
conn.close()

def get_all_submissions_and_logs():
cur = None
conn = None
Expand All @@ -1073,14 +1035,13 @@ def get_all_submissions_and_logs():
query = """
SELECT json_build_object(
'submission_id', submissions.submission_id,
'apcd_id', submissions.apcd_id,
'entity_name', submitters.entity_name,
'submitter_id', submissions.submitter_id,
'file_name', submissions.zip_file_name,
'status', submissions.status,
'outcome', submissions.outcome,
'received_timestamp', submissions.received_timestamp,
'updated_at', submissions.updated_at,
'org_name', submitters.org_name,
'view_modal_content', (
SELECT COALESCE(json_agg(json_build_object(
'log_id', submission_logs.log_id,
Expand All @@ -1101,7 +1062,7 @@ def get_all_submissions_and_logs():
ON submitters.submitter_id = submissions.submitter_id
LEFT JOIN submission_logs
ON submissions.submission_id = submission_logs.submission_id
GROUP BY (submissions.submission_id, submitters.org_name)
GROUP BY (submissions.submission_id, submitters.entity_name)
ORDER BY submissions.received_timestamp DESC
"""
cur = conn.cursor()
Expand Down

0 comments on commit ddfde91

Please sign in to comment.