Add editable side pre-allocations matrix - #2924
Open
tienne-B wants to merge 7 commits into
Open
Conversation
…/sides Upgrades the previously read-only Side Pre-Allocations page: already-drawn rounds now show each team's actual side, the next undrawn round is editable per-team via a dropdown, and a bulk tool copies (same or opposite) every team's pre-allocation from any earlier finished round in one action, skipping teams with no result that round (e.g. a bye). No new preferences, permissions, or migrations; the public read-only page is untouched. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
CI runs manage.py test from the repo root rather than the tabbycat/ directory, which makes Django's test discovery import this module as tabbycat.draw.tests.test_views. The relative imports (from ..models, from ..dbutils) then resolved to a second, freshly-executed copy of draw/models.py under that path, and Django's model metaclass couldn't match the re-defined Debate model to any installed app, crashing the whole test run. Every other module in the codebase, including sibling files in draw/tests/, imports the draw app absolutely (from draw.models import ...) for the same reason -- matching that convention here fixes the crash without touching any other file.
The draw.* imports need to be alphabetized together with the other local-app imports (draw < tournaments < utils), in one group with no blank line between, per this project's flake8-import-order config.
The target round was previously hardcoded to the immediate next undrawn round. It's now a dropdown listing every undrawn preliminary round, since the view already supported an arbitrary target - only the template needed to change. A further-out undrawn round's matrix cell now also shows its pre-allocation read-only (instead of always "-") once one has been set via the bulk tool, so the result is visible. Also adds a short explanation above the matrix of how drawn vs undrawn rounds are displayed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
tienne-B
commented
Sep 2, 2026
| # side (read-only, since editing the pre-allocation at that point is | ||
| # a no-op); the first round without a draw yet is editable; any | ||
| # further undrawn rounds show their pre-allocation read-only. | ||
| editable_round = next((r for r in rounds if r.draw_status == Round.Status.NONE), None) |
Member
Author
There was a problem hiding this comment.
Why not allow editing any future round?
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.
Problem
Side pre-allocations can only be reviewed as a read-only matrix, making it cumbersome to lock individual team sides or seed a future round from sides already used in a confirmed draw.
Solution
Make the next undrawn round editable inline with a reusable AJAX select table cell and save indicator. Drawn rounds show actual sides, while a bulk tool can copy the same or opposite sides from a confirmed round into any undrawn preliminary round. Changes are permission-checked and action-logged.
Testing