Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task/WP-857 & 858: View submissions updates #428

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

edmondsgarrett
Copy link
Contributor

@edmondsgarrett edmondsgarrett commented Feb 20, 2025

Overview

Adds payor code column + filter to admin view submissions and adjusts backend to accommodate org name info for "translating" payor code to org name

Related

Changes

  • Add submitters.org_name to both get submission db queries for use as payor codes on each listing
  • Adjusts respective views for both user and admin submissions listings to accommodate db query updates
  • Adds submitters.org_name to common_api entities view for sorting purposes
  • Adds payor code column and filter dropdown to admin submissions listing
  • Adjusts "No Data Available" message on both tables to span by # columns in header (previously hard-coded number)

Testing

  1. Go to http://localhost:8000/submissions/list-submissions/ and confirm payor code now shows an organization name rather than an 8-digit code, and test for regressions
  2. Go to http://localhost:8000/administration/list-submissions/ and confirm there is an additional 'Payor Code' column showing the same info as previous page
  3. Test payor code filter and confirm it filters as expected

UI

Notes

  • Admin submissions payor code filter populates very slowly, takes a lot of time from when page loads (seen minimum 10-12 sec), not sure where the slowdown is occurring, narrowed it down to the get_submitter_info db query

…n view submissions, org name to common_api entities view, and translated payor code to user view submissions
Copy link
Contributor

@chandra-tacc chandra-tacc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added couple required changes.


logger = logging.getLogger(__name__)


class EntitiesView(APCDGroupAccessAPIMixin, BaseAPIView):
def get(self, request, *args, **kwargs):
submitters = apcd_database.get_submitter_info(request.user.username)
from_admin = json.loads(request.GET.get('from_admin', False)) # for admin submissions page, need all submitters, not just for requesting user
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent non admin users from request data just by using query param.

Suggested change
from_admin = json.loads(request.GET.get('from_admin', False)) # for admin submissions page, need all submitters, not just for requesting user
from_admin = json.loads(request.GET.get('from_admin', False)) # for admin submissions page, need all submitters, not just for requesting user
if from_admin and not is_apcd_admin(request.user):
return JsonResponse({'error': 'Unauthorized'}, status=403)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants