Skip to content

Match WindowsType seed names to production (title case)#1534

Merged
maebeale merged 3 commits into
mainfrom
maebeale/titlecase-windows-type-names
May 26, 2026
Merged

Match WindowsType seed names to production (title case)#1534
maebeale merged 3 commits into
mainfrom
maebeale/titlecase-windows-type-names

Conversation

@maebeale
Copy link
Copy Markdown
Collaborator

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

  • Bring our WindowsType seeds and factory in line with what actually lives in production.
  • In production, the three WindowsType rows are Adult / Children / Combined (title case, single word) — both the name and short_name columns. 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.
  • That drift silently breaks code that looks up a WindowsType by name, for example WindowsType.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 three WindowsType rows with name set to the same title-case value as short_name.
  • spec/factories/windows_types.rb: update the :adult, :children, :combined traits to use the new names so factory-built records mirror prod.
  • app/controllers/bookmarks_controller.rb: switch from a case-sensitive LIKE "%COMBINED%" exclusion to a direct where.not(name: "Combined") now that the name is a stable single word.
  • Leaving app/models/concerns/reportable.rb alone for now — its form_builder method also compares against the old "ADULT WORKSHOP LOG" / "CHILDREN WORKSHOP LOG" strings, but that file only exists on the monthly-reports-index branch (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

  • Run bin/rails db:seed on a fresh DB and confirm the three WindowsType rows have name/short_name set to Adult / Children / Combined.
  • On an existing dev DB, manually update the three WindowsType rows to match (or wipe and reseed).
  • WorkshopVariation form: confirm the windows-type dropdown defaults to Combined (was previously broken because find_by(name: "Combined") returned nil).
  • Bookmarks index: sortable fields still exclude Combined.

Anything else to add?

  • This is a pure naming-alignment PR; no behavior changes were intended beyond fixing the lookups that were already supposed to work.

maebeale and others added 2 commits May 25, 2026 22:54
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>
@maebeale maebeale marked this pull request as ready for review May 26, 2026 03:01
@maebeale maebeale merged commit d9de6b7 into main May 26, 2026
3 checks passed
@maebeale maebeale deleted the maebeale/titlecase-windows-type-names branch May 26, 2026 03:39
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.

1 participant