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

Fix: View users org dropdown not consistently populating with selected organization #150

Merged
merged 3 commits into from
May 17, 2023

Conversation

edmondsgarrett
Copy link
Contributor

Overview

Related

Changes

  • Instead of removing duplicates in the filter dropdown in the template, now preventing duplicates in the list which populates said dropdown in the page's view

Testing

  1. Replace line 12 of view_users/views.py with the following:

    Snippet
      user_content = [
     (
         6,
         4,
         '[aw@heck.org](mailto:aw@heck.org)',
         'Jon Heck',
         'UHC & Nop',
         'no create',
         'none update',
         'no notes',
         'True',
         7,
         'submitter'
     ),
     (
         6,
         4,
         '[aw@snow.org](mailto:aw@heck.org)',
         'Jon Snow',
         'UHC & Nop',
         'no create',
         'none update',
         'no notes',
         'True',
         11,
         'submitter'
     ),
     (
         5,
         4,
         '[aw@heck.org](mailto:aw@heck.org)',
         'Alex Hamilton',
         't and (t)',
         'no create',
         'none update',
         'no notes',
         'True',
         8,
         'submitter',
     ),
     (
         5,
         4,
         '[aw@heck.org](mailto:aw@heck.org)',
         'Penny Ante',
         'UHC',
         'no create',
         'none update',
         'no notes',
         'True',
         10,
         'submitter'
     ),
     ]
    
  2. Load http://localhost:8000/administration/view-users/

  3. Click through the options in the filter dropdown and ensure, on page reload:

    • Correct entries are shown in table based on filter chosen
    • Chosen filter shows on dropdown

UI

Notes

From Slack: "Found the bug - duplicates in the dropdown were being handled in the template, so when an org with multiple table entries was chosen, multiple elements were created with the selected prop, and then all but one would be subsequently removed - as this isn't a multi-select-enabled element, just the last option would actually be shown in the dropdown, but just the first of the duplicates was kept in the list, so it wasn't shown."

Copy link
Contributor

@fnets fnets left a comment

Choose a reason for hiding this comment

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

LGTM and works locally, and definitely a more robust solution to do data manipulation in the backend. Great job!

Copy link
Contributor

@sophia-massie sophia-massie left a comment

Choose a reason for hiding this comment

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

LGTM!

@fnets fnets merged commit 0f4d061 into main May 17, 2023
@fnets fnets deleted the fix/view-users-selected-filter-not-populating branch May 17, 2023 20:25
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.

3 participants