Convert monthly reports to standard REST with shared filters#1530
Merged
Conversation
Refactors the MR controller to use standard REST resources and matches the filter UX (month/year/workshop/person/organization) the workshop log index already uses, so the two report types feel like siblings rather than parallel ad-hoc flows. Extracts shared Report behaviors into a Reportable concern that both MonthlyReport and WorkshopLog include, removing the duplication that had built up between them. Old controller kept as monthly_reports_controller_old.rb for reference during the cutover. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Prep work for retiring Report. MonthlyReport still inherits from Report
(STI dispatch is needed for polymorphic refs like sectorable_type='Report'),
but now declares its own associations, scopes, and methods so it can stand
on its own when Report goes away.
Dropped pieces that don't apply to MR:
- workshop (0/11,316 in prod)
- has_one :form / has_many :form_fields, through: :form (owner-based, unused)
- has_many :media_files (already converted to GalleryAsset)
- accepts_nested_attributes_for :primary_asset (unused)
- story? helper, form_builder / on_going_participants / new_participants
(only used internally, dead once we stopped creating MRs)
Simplified users_admin_type to the MR-only branch, name to literal "Monthly
Report ##{id}".
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The _old file was a reference copy added during the REST refactor and is no longer used. Removing it also clears the only remaining brakeman warning (Mass Assignment via `params[:quotes].permit!`). Drops the two obsolete brakeman.ignore entries that pointed at code that no longer exists. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Reverts the file to its prior state at maebeale's request. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Keeps the pre-REST-refactor controller around for reference without triggering Brakeman (which only scans .rb). Mirrors the original snapshot header that pointed at commit f96a98a. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Report and MonthlyReport both define associations/scopes inline, so the concern has no remaining includers. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
These were dropped during the REST refactor but are still referenced by the participant-total aggregations on the index. Placed near the bottom of the public methods so the canonical attribute readers stay toward the top. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
4 tasks
maebeale
added a commit
that referenced
this pull request
May 26, 2026
* Match WindowsType seed names to production (title case)
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>
* Update report.rb and bookmark.rb to match new WindowsType names
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>
* Retrigger CI to check workshop_variations_spec failure stability
---------
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?
MonthlyReportandWorkshopLogby extracting their shared model behavior into aReportableconcern.How did you approach the change?
MonthlyReportsControlleragainst standard REST actions (index,show) and gave it a search/filter index that mirrorsWorkshopLogsController: month/year, workshop, person, organization.Reportmodel behavior (associations, scopes, nested attrs, search, etc.) intoapp/models/concerns/reportable.rb, included by bothMonthlyReportand the baseReport.monthly_reports/edit.html.erbsince the new REST flow doesn't surface MR editing here.resources :monthly_reports, only: [ :index, :show ], plus a nested index under organizations. Dropped the legacyreports/monthly*routes.monthly_reports_controller_old.rbfor reference during the cutover — will be removed once we're confident the new flow covers all legacy entry points.UI Testing Checklist
Anything else to add?
_oldcontroller file is intentionally committed for the cutover and will be deleted in a follow-up once the legacy entry points are confirmed dead.