-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Background
The current validation model enforces strict constraints for matches:
- Both teams must belong to the same Division.
- If a StageGroup (e.g., Pool) is involved, both teams must also belong to the same StageGroup.
These validations ensure that competition matches are appropriately grouped and are counted for standings and progression.
However, in certain cases such as friendlies, showcase events, or cross-division matchups, flexibility is required.
Objectives
- Introduce flexibility to allow certain matches to bypass strict Division and StageGroup validation.
- Ensure such matches are clearly marked and do not affect standings.
- Provide a safe, controlled way for administrators to create and manage these matches.
Implementation Plan
1. Model Adjustments
- Add a boolean field to the
Matchmodel:ignore_group_validation(defaultFalse). - If
ignore_group_validationisTrue, skip validation logic for team division and group consistency.
2. Admin Interface
- Update the admin match form to include a visible
ignore_group_validationtoggle. - Add a warning/help text in the UI to explain the consequences of enabling this toggle.
3. Frontend Display
- On all user-facing views (results, schedule, match details), display a visible badge or notice that the match is non-standard and does not count toward standings.
- Exclude these matches from league table calculations and stage progression.
4. Backend Validation Logic
- Wrap the existing validation logic for division/group consistency in a conditional block:
if not self.ignore_group_validation: # existing validation logic
5. Stage Configuration
- Allow the ability to configure a Stage with a flag like
allow_cross_division_matches. - If this is set, matches within that stage can automatically allow the
ignore_group_validationfield to beTrue.
Testing Strategy
Be sure to write tests using the django-test-plus style.
Unit Tests
- Ensure
ignore_group_validation=False(default) retains existing behavior. - Create valid matches across divisions/groups with
ignore_group_validation=True. - Test admin interface to ensure toggle works correctly.
- Verify excluded logic for standings computation.
- Confirm frontend renders appropriate notices or tags for such matches.
Integration Testing
- Use the test site to simulate the creation and display of both standard and special matches.
- Confirm no regressions in scheduling, reporting, or display.
Test Coverage Expectations
- Unit test match creation with and without override.
- Test list view exclusions/inclusions for standings.
- Add UI test for admin toggle visibility and help text.
Deployment Considerations
- Migrations must be created for any new fields.
- All admin/staff should be informed of the new toggle.
- Frontend caching layers (if any) may need to be cleared or adjusted to show changes.
Documentation
- Update internal match creation docs with a note about this new flexibility.
- Include visual example of a non-standard match in screenshots or help content.
Notes
This feature is designed to augment the existing system, not replace existing match validation.
Care must be taken to limit usage of the override field only to matches that truly require it.
Reactions are currently unavailable