Skip to content

Commit

Permalink
WP-494: handle null entity_names when using exception and extensions …
Browse files Browse the repository at this point in the history
…in admin view (#275)

* WP-494: handle null entity_names when using exception and extensions in admin view

* Handle empty string in drop down
  • Loading branch information
chandra-tacc committed Feb 15, 2024
1 parent 7634f3c commit 9a15e2a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions apcd-cms/src/apps/admin_exception/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ def getDate(row):
context['org_options'].append(entity_name)
# to make sure All is first in the dropdown filter options after sorting alphabetically
context['org_options'] = sorted(context['org_options'], key=lambda x: (x != 'All', x))
# Remove empty strings
context['org_options'] = [option for option in context['org_options'] if option != '']
if status not in context['status_options']:
if status != None:
context['status_options'].append(status)
Expand Down
2 changes: 2 additions & 0 deletions apcd-cms/src/apps/admin_extension/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def getDate(row):
if entity_name not in context['org_options']:
context['org_options'].append(entity_name)
context['org_options'] = sorted(context['org_options'], key=lambda x: (x != 'All', x))
# Remove empty strings
context['org_options'] = [option for option in context['org_options'] if option != '']
if status not in context['status_options']:
context['status_options'].append(status)
context['status_options'] = sorted(context['status_options'], key=lambda x: (x != 'All', x))
Expand Down
4 changes: 2 additions & 2 deletions apcd-cms/src/apps/utils/apcd_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ def get_all_extensions():
extensions.requestor_email,
extensions.explanation_justification,
extensions.notes,
submitters.entity_name
COALESCE(NULLIF(submitters.entity_name, ''), '') as entity_name
FROM extensions
JOIN submitters
ON extensions.submitter_id = submitters.submitter_id
Expand Down Expand Up @@ -1400,7 +1400,7 @@ def get_all_exceptions():
exceptions.approved_expiration_date,
exceptions.status,
exceptions.notes,
submitters.entity_name,
COALESCE(NULLIF(submitters.entity_name, ''), '') as entity_name,
standard_codes.item_value
FROM exceptions
JOIN submitters
Expand Down

0 comments on commit 9a15e2a

Please sign in to comment.