Skip to content

Conversation

@kellis5137
Copy link
Contributor

@kellis5137 kellis5137 commented Aug 1, 2025

Partial #4948

Description

This is a partial resolution to this problem. There is only one fix in this ticket, but it's been a while since I've worked with Ruby on Rails and, in particular, I want to make sure my spec looks good before I do other fixes.

The general problem is that some of the dropdown, lists, etc, are not being sorted in a human understandable alphabetical order. I am currently working through the app, looking for related issues.

No gems need to be updated/added.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

via Unit test. Basically, when the data in the "resources_id" drop downs are displayed, they should be listed in case-insensitive alphabetical order.

@kellis5137 kellis5137 force-pushed the 4948-fix-sort-issues-1 branch from da94875 to 5de4794 Compare August 1, 2025 14:42
@cielf cielf requested a review from dorner August 1, 2025 22:07
@cielf
Copy link
Collaborator

cielf commented Aug 1, 2025

@dorner Could you take a look and let @kellis5137 know if there are any issues with their approach? Thanks!

@cielf
Copy link
Collaborator

cielf commented Aug 2, 2025

@kellis5137 I changed the "Resolves" to "Partial" above -- that way the workflow won't close the issue when this is merged.

@kellis5137
Copy link
Contributor Author

kellis5137 commented Aug 2, 2025 via email

@cielf
Copy link
Collaborator

cielf commented Aug 2, 2025

Hey @kellis5137 -- where does this show up in the UI? -- I signed in as superadmin and checked selecting an organization when adding a user, and it is in (Pawnee Diaper Bank, SF Diaper Bank, Second City Essentials Bank) order, whereas it should be in (Pawnee Diaper Bank, Second City Essentials Bank, SF Diaper Bank) order. Am I looking in the wrong place?

@kellis5137
Copy link
Contributor Author

Hey @kellis5137 -- where does this show up in the UI? -- I signed in as superadmin and checked selecting an organization when adding a user, and it is in (Pawnee Diaper Bank, SF Diaper Bank, Second City Essentials Bank) order, whereas it should be in (Pawnee Diaper Bank, Second City Essentials Bank, SF Diaper Bank) order. Am I looking in the wrong place?

Hmm.... I'll take a look, maybe I missed something

@kellis5137
Copy link
Contributor Author

Hey @kellis5137 -- where does this show up in the UI? -- I signed in as superadmin and checked selecting an organization when adding a user, and it is in (Pawnee Diaper Bank, SF Diaper Bank, Second City Essentials Bank) order, whereas it should be in (Pawnee Diaper Bank, Second City Essentials Bank, SF Diaper Bank) order. Am I looking in the wrong place?

@cielf It's so weird unless I'm looking at it wrong, but I've tried adding more resources in orders that should have thrown off the old code and still it's coming up in order.

image

Is there another person that can give it a go?

@cielf
Copy link
Collaborator

cielf commented Aug 7, 2025

I'll try it again tomorrow -- it's possible that I had the wrong branch up.

@cielf
Copy link
Collaborator

cielf commented Aug 7, 2025

With 4948-fix-sort-issues 1

Signed in as superadmin@example.com
Click Users
Click New User
click in the box for Resource

I get:
Screenshot 2025-08-07 at 1 07 20 PM

@cielf
Copy link
Collaborator

cielf commented Aug 7, 2025

@kellis5137 Is it possible you haven't pushed your latest changes?

@kellis5137
Copy link
Contributor Author

kellis5137 commented Aug 7, 2025 via email

@cielf
Copy link
Collaborator

cielf commented Aug 7, 2025

Oh - I'm not saying that's it -- I mostly do the functional testing, my Ruby's not advanced -- but/and on first glance, it looks to me like the code that's here would do ASCI sorting of the mixed case name, rather than of the lower-case. It's also possible that your environment works differently than mine.

@kellis5137
Copy link
Contributor Author

kellis5137 commented Aug 8, 2025

@cielf Oops, I think my problem is I was thinking this project was using MariaDB, not Postgres. They handle case sensitivity different. Try downloading the latest and let me know if it works. I also fixed the case insensitivity of the filter field as well. Give my latest a try.

@kellis5137
Copy link
Contributor Author

Question: Should this be sort by the number, the name, or does it matter?

image

@cielf
Copy link
Collaborator

cielf commented Aug 9, 2025

IIRC, that is currently by number, and should stay that way. Thanks for pointing it out!

@kellis5137
Copy link
Contributor Author

IIRC, that is currently by number, and should stay that way. Thanks for pointing it out!

But it doesn’t seem to be sorted by either.

@cielf
Copy link
Collaborator

cielf commented Aug 10, 2025

Sorry -- It turns out I did not, indeed, remember correctly!

I just double-checked production. The initial set are effectively sorted by name -- so I think that's the business's intent -- then later joiners are tacked on the end.

So, let's make it by name.

Thank you for your patience and sorry for the confusion

@kellis5137
Copy link
Contributor Author

Sorry -- It turns out I did not, indeed, remember correctly!

I just double-checked production. The initial set are effectively sorted by name -- so I think that's the business's intent -- then later joiners are tacked on the end.

So, let's make it by name.

Thank you for your patience and sorry for the confusion

@cielf I thought sent you a message, but I guess I didn't I believe the issue was I was thinking in terms of MySQL/MariaDB, but this project uses Postgres. Try downloading the latest and let me know if it's working now!

@cielf
Copy link
Collaborator

cielf commented Aug 21, 2025

@kellis5137 -- this PR does not include the sort for the NDBN memberships you asked the question about, right?

Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

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

Passes functional check (limited to the drop down for organizations in edit user). On to @dorner for any technical quibbles.

@cielf
Copy link
Collaborator

cielf commented Aug 21, 2025

Have also changed "resolves" to 'partial' - @kellis5137 for future -- please reserve "resolves" for PRs that totally resolve the issue, as our workflow closes the issue when we merge a PR that "resolves" an issue.

@kellis5137
Copy link
Contributor Author

kellis5137 commented Aug 21, 2025 via email

end
end

describe "Resourse Dropdown List: Validate Order" do
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we change this to a request spec? System specs are slow and flaky and should only be used if there needs to be browser / JavaScript interaction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dorner Take a look now and let me know if that looks better

# params
# - resource_type - Organization, Resource
# - q - query string
# visit admin_users_resource_ids_path # (name: "Organization", q: "")
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is pretty basic Rails info and I don't think we need a comment for it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dorner Take a look now and let me know if that looks better

@kellis5137 kellis5137 force-pushed the 4948-fix-sort-issues-1 branch from 69f3fcd to 81b68ef Compare August 28, 2025 22:39
it "Should sort display resource in human alphabetical order" do
get "/admin/users/resource_ids?resource_type=org_admin"
puts response.body
expect(response.body).to match(/{"results":\[{"id":\d+,"text":"Org ABC"},{"id":\d+,"text":"Pawnee"},{"id":\d+,"text":"Second City"},{"id":\d+,"text":"SF Diaper"}]}/)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If the response is JSON, it's much better to actually parse the JSON and use more specific matchers rather than regular expressions, which can be flakier.

@kellis5137 kellis5137 force-pushed the 4948-fix-sort-issues-1 branch from d863486 to cb70bad Compare September 6, 2025 19:20
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.

4 participants