Fix workshop capacity checks#2605
Merged
mroderick merged 1 commit intocodebar:masterfrom May 5, 2026
Merged
Conversation
Fixed bug in workshop fabricator: transients[:coach_count || 10] → transients[:coach_count] || 10. This was causing incorrect coach spaces to be set. Added student_spaces and coach_spaces attributes to workshop fabricator to ensure capacity checks work correctly. Updated controller and view to use event_student_spaces? and event_coach_spaces? methods instead of delegating to venue. This ensures capacity checks use workshop attributes directly. Updated test files to set workshop.student_spaces and workshop.coach_spaces directly for capacity-related tests.
Collaborator
Author
|
Note on the nature of this bug: This is a pre-existing bug that we discovered during test optimization work. The capacity checks were inadvertently using venue (sponsor) attributes instead of workshop attributes: Before (buggy):
After (fixed):
The tests were passing before because the fabricator was setting up the host with matching attributes, and tests were updating to simulate capacity limits. We discovered the bug when trying to simplify tests to use workshop attributes directly. |
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.
Summary
This PR fixes a bug in workshop capacity checks where the workshop fabricator had incorrect transient variable syntax, and the controller/view were using venue attributes instead of workshop attributes for capacity checks.
Changes
1. Fix workshop fabricator bug
transients[:coach_count || 10]→transients[:coach_count] || 10student_spacesandcoach_spacesattributes to workshop fabricator2. Fix controller capacity checks
available_spaces?to useevent_student_spaces?andevent_coach_spaces?3. Fix view capacity checks
event_coach_spaces?andevent_student_spaces?4. Update test files
accepting_invitation_spec.rbandcoach_accepting_invitation_spec.rbworkshop.student_spacesandworkshop.coach_spacesdirectlyWhy this fix is needed
The previous implementation checked capacity via the venue (sponsor) attributes:
But the controller should check workshop attributes directly:
This ensures that capacity limits are controlled per-workshop, not per-venue.
Testing
All 995 tests pass with this fix.