Match WindowsType seed names to production (title case)#1534
Merged
Conversation
Production WindowsType records are stored with simple title-case names —
"Adult", "Children", "Combined" — but our seeds and factory were still
using the older verbose all-caps forms ("ADULT WINDOWS", etc.) that no
longer exist anywhere. That mismatch silently broke any code that looked
up a WindowsType by name (e.g. the workshop_variations form's "Combined"
default), and made the bookmarks_controller LIKE-match for "%COMBINED%"
unnecessarily fragile.
Aligns the seed/factory names with production and switches the bookmarks
LIKE query to a direct equality exclusion now that the name is a stable
single word. A matching tweak to reportable.rb's form_builder lookup
will follow once #1530 merges.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Report#form_builder and Bookmark.windows_type were still comparing
against the older verbose names ("ADULT WORKSHOP LOG", "ADULT WORKSHOP",
etc.) that no longer exist on any WindowsType record. Both have been
silently broken — form_builder returned nil for every MonthlyReport, and
the bookmark windows_type filter returned no matches.
Updates both to use the title-case single-word names. Bookmark's filter
also switches from a case-sensitive LIKE pattern to direct equality now
that the name is a stable single word.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the goal of this PR and why is this important?
WindowsTypeseeds and factory in line with what actually lives in production.WindowsTyperows areAdult/Children/Combined(title case, single word) — both thenameandshort_namecolumns. Our seeds and factory were still creating them with the older verbose names (ADULT WINDOWS,CHILDREN'S WINDOWS,ADULT & CHILDREN COMBINED (FAMILY) WINDOWS), which haven't matched prod for some time.WindowsTypebyname, for exampleWindowsType.find_by(name: "Combined")in the workshop_variation form, which currently returns nil against the older seed data.How did you approach the change?
db/seeds.rb: create the threeWindowsTyperows withnameset to the same title-case value asshort_name.spec/factories/windows_types.rb: update the:adult,:children,:combinedtraits to use the new names so factory-built records mirror prod.app/controllers/bookmarks_controller.rb: switch from a case-sensitiveLIKE "%COMBINED%"exclusion to a directwhere.not(name: "Combined")now that the name is a stable single word.app/models/concerns/reportable.rbalone for now — itsform_buildermethod also compares against the old"ADULT WORKSHOP LOG"/"CHILDREN WORKSHOP LOG"strings, but that file only exists on themonthly-reports-indexbranch (PR Convert monthly reports to standard REST with shared filters #1530). A 1-line follow-up will update it once Convert monthly reports to standard REST with shared filters #1530 merges.UI Testing Checklist
bin/rails db:seedon a fresh DB and confirm the threeWindowsTyperows havename/short_nameset toAdult/Children/Combined.WindowsTyperows to match (or wipe and reseed).Combined(was previously broken becausefind_by(name: "Combined")returned nil).Combined.Anything else to add?