Show windows type in workshop select dropdowns#1318
Conversation
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>
ded9aa4 to
5e5cdb9
Compare
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>
01aa54f to
7cf0317
Compare
…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 | ||
|
|
There was a problem hiding this comment.
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)
jmilljr24
left a comment
There was a problem hiding this comment.
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.
|
@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. |
What is the goal of this PR and why is this important?
#IDwhen multiple search results share the same title and type, keeping labels cleanHow did you approach the change?
remote_search_labelinstance method override on Workshop to return"Title (ShortName)"remote_search_labelsclass method on Workshop that post-processes a collection to append#IDonly for duplicate labelsremote_search_labelstoRemoteSearchableconcern (just maps toremote_search_label)SearchControllerto callmodel_class.remote_search_labels(records)instead of mapping individuallyremote_searchto eager-loadwindows_typeto avoid N+1 queriesremote_search_label[:label]for the pre-selected workshop valueremote_search_label[:label]UI Testing Checklist
Anything else to add?
type_namemethod pattern but splits it: base label omits ID, collection-level disambiguation adds it only when neededremote_search_labelsdefault inRemoteSearchablemeans other models (Person, User, Organization) are unaffected🤖 Generated with Claude Code