Skip to content

Member search #2260

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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Member search #2260

wants to merge 13 commits into from

Conversation

jonodrew
Copy link
Contributor

@jonodrew jonodrew commented Aug 9, 2025

This adds a controller and little view for doing member searches. Full implementation of this pattern will require calling services to add a callback param to the request to MemberSearch, which it will then GET once the Member(s) have been found.

If only one member is found from the search, I've chosen to assume that it's correct and we skip straight to redirecting to the calling service. That might be a faulty assumption.

I'm going to clear up the commit history, but it'll give you an early sense of how this is working. Screenshots!

Screenshot 2025-08-09 at 22 14 09 Screenshot 2025-08-09 at 22 14 29

@jonodrew
Copy link
Contributor Author

@matyikriszta do you mind giving me a sense-check on this? Does it look like it's going in the right direction?

@jonodrew jonodrew force-pushed the member-search branch 3 times, most recently from 13e5ec6 to 28cf0f8 Compare August 13, 2025 07:47
Copy link
Collaborator

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

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

Just wanted to share some Rails thoughts.

EDIT: I don't want to block you, perhaps we can pair sometime, to brain-sync on this!

@davidmillen50
Copy link
Contributor

what happens if you try to search with no search terms?

@jonodrew jonodrew force-pushed the member-search branch 3 times, most recently from df5f60f to cc279c5 Compare August 14, 2025 09:34
@jonodrew
Copy link
Contributor Author

what happens if you try to search with no search terms?

That was a good question. I've added a check against it returning the entire table!

@jonodrew
Copy link
Contributor Author

Tests are not failing, coveralls is 😞

@jonodrew jonodrew marked this pull request as ready for review August 16, 2025 11:02
@jonodrew
Copy link
Contributor Author

jonodrew commented Aug 16, 2025

@olleolleolle @matyikriszta @KimberleyCook - I'd like to integrate this code into the codebase before I start working on calling it from elsewhere. I suspect the approach is going to be a little complex, and I don't want to make a massive change all at once.

Tests are passing locally but not here - there's more flakiness around I think.

Going forward, I'm thinking about how this can be incorporated into other calling services. I'm considering moving the logic in Admin::InvitationsController#update_attendance into a method on the Invitation model, so I can access it from within any Controller. Let me know what you think.

This sets up a basic test case, controller, and a form for doing search. This will allow a calling service to find a member and then do something with them
This has been educational! I've added four tests to check for how the controller processes the member search journey. I'm happy with where it's got to, and it's meant I've had a chance to clarify my controller code.
This is a small change that lets me access the db from my IDE. In turn this let me generate a diagram of the database structure.

It took several minutes
These tests will track the full journey for an admin user who wants to add a Member to a workshop
This feature test checks the flow when there's only one matching member

Signed-off-by: jonathan.kerr <[email protected]>
This adds three tests for the model method and improves the model method

Signed-off-by: jonathan.kerr <[email protected]>
Based on feedback from @olleolleolle, I've updated this controller to only use local variables

Signed-off-by: jonathan.kerr <[email protected]>
I want to avoid returning the whole Member table if a user accidentally forgets to put in a search term. Although this can be managed with validation, I'm applying this at the lowest level for maximal protection

Signed-off-by: jonathan.kerr <[email protected]>
This ensures there will always be at least two Members in the tests where they're needed

Signed-off-by: jonathan.kerr <[email protected]>
This test essentially just replicates the test above
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