Skip to content

Show windows type in workshop select dropdowns#1318

Open
maebeale wants to merge 6 commits intomainfrom
maebeale/show-windows-type-in-select
Open

Show windows type in workshop select dropdowns#1318
maebeale wants to merge 6 commits intomainfrom
maebeale/show-windows-type-in-select

Conversation

@maebeale
Copy link
Collaborator

@maebeale maebeale commented Mar 3, 2026

What is the goal of this PR and why is this important?

  • Duplicate record handling: workshop remote-select and searchable-select fields previously only showed the workshop title, making it hard to distinguish workshops with the same name but different windows types
  • Now displays title with windows type short_name in parens, e.g. "Healing Through Color (Adult)"
  • Only appends #ID when multiple search results share the same title and type, keeping labels clean
  • Workshop edit page heading now also shows the full title with windows type

How did you approach the change?

  • Added remote_search_label instance method override on Workshop to return "Title (ShortName)"
  • Added remote_search_labels class method on Workshop that post-processes a collection to append #ID only for duplicate labels
  • Added default remote_search_labels to RemoteSearchable concern (just maps to remote_search_label)
  • Updated SearchController to call model_class.remote_search_labels(records) instead of mapping individually
  • Overrode remote_search to eager-load windows_type to avoid N+1 queries
  • Updated 5 view form partials to use remote_search_label[:label] for the pre-selected workshop value
  • Added duplicate-title seed workshops ("Healing Through Color") to exercise disambiguation in dev
  • Updated workshop edit page heading to show remote_search_label[:label]

UI Testing Checklist

  • Search for a workshop with a unique title in any workshop select dropdown — shows "Title (Type)" without ID
  • Search for "Healing Through Color" — both results show "Healing Through Color (Adult) #ID"
  • Edit a workshop log — pre-selected workshop shows "Title (Type)" without ID
  • Edit a story — pre-selected workshop shows "Title (Type)" without ID
  • Edit a workshop variation — pre-selected workshop shows "Title (Type)" without ID
  • Edit a story idea — pre-selected workshop shows "Title (Type)" without ID
  • Edit a workshop variation idea — pre-selected workshop shows "Title (Type)" without ID
  • Workshop edit page heading shows "Edit workshop: Title (Type)"

Anything else to add?

  • Uses the existing type_name method pattern but splits it: base label omits ID, collection-level disambiguation adds it only when needed
  • The remote_search_labels default in RemoteSearchable means other models (Person, User, Organization) are unaffected

🤖 Generated with Claude Code

maebeale and others added 2 commits March 3, 2026 08:20
Workshop remote-select and searchable-select fields now display
type_name (title + windows type short_name + ID) instead of just
the title, making it easier to distinguish workshops of different types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@maebeale maebeale force-pushed the maebeale/show-windows-type-in-select branch from ded9aa4 to 5e5cdb9 Compare March 3, 2026 14:38
maebeale and others added 3 commits March 3, 2026 09:46
Workshop search labels now show "Title (Type)" by default and only
append "#ID" when multiple results share the same title and type.
Adds remote_search_labels class method to RemoteSearchable for
collection-level label disambiguation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two workshops named "Healing Through Color" with the same windows
type so the ID suffix disambiguation logic can be tested in dev.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@maebeale maebeale force-pushed the maebeale/show-windows-type-in-select branch from 01aa54f to 7cf0317 Compare March 3, 2026 15:36
…ing?

eager_loading? is an internal Rails method that may not return true
in all cases. includes_values reliably checks that the association
is queued for eager loading.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
labels.each { |l| l[:label] = "#{l[:label]} ##{l[:id]}" if dupes.include?(l[:label]) }
labels
end

Copy link
Collaborator Author

@maebeale maebeale Mar 3, 2026

Choose a reason for hiding this comment

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

update workshop-specific remote search label display. and conditionally show workshop #ID if there are two workshops w same name AND windows type short name (there are many of these rn in prod dataset)

@maebeale maebeale requested a review from jmilljr24 March 3, 2026 15:51
Copy link
Collaborator

@jmilljr24 jmilljr24 left a comment

Choose a reason for hiding this comment

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

On a quick test this look good to me. Are you ok with waiting to deploy it? The remote search is used in a lot of place for regular uses and I'd like to give it a better look. I think this issue really only affect admins because most of the dups are hidden so only admin should be seeing them.

@maebeale
Copy link
Collaborator Author

maebeale commented Mar 3, 2026

@jmilljr24 yes, fine to wait! i added it in tho bc in the video he's not logged in as an admin and i saw lots of "dupes" in the dropdown. basically, there are a bunch of workshops that are not dupes bc they are for different windows types, so surfacing the windows type sooner rather than later will help users as they pick their workshops on the various forms. but, yeah, this was the pr i thought needed the most reviewing.

@jmilljr24
Copy link
Collaborator

@jmilljr24 yes, fine to wait! i added it in tho bc in the video he's not logged in as an admin and i saw lots of "dupes" in the dropdown. basically, there are a bunch of workshops that are not dupes bc they are for different windows types, so surfacing the windows type sooner rather than later will help users as they pick their workshops on the various forms. but, yeah, this was the pr i thought needed the most reviewing.

Oooh ok. I'll spend some time on it tomorrow and then we can get it in.

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