Skip to content

Add editable side pre-allocations matrix - #2924

Open
tienne-B wants to merge 7 commits into
TabbycatDebate:developfrom
tienne-B:codex/side-locks
Open

Add editable side pre-allocations matrix#2924
tienne-B wants to merge 7 commits into
TabbycatDebate:developfrom
tienne-B:codex/side-locks

Conversation

@tienne-B

@tienne-B tienne-B commented Sep 2, 2026

Copy link
Copy Markdown
Member

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

  • Open Side Pre-Allocations with confirmed and undrawn rounds; change a side, confirm the save indicator updates, and refresh to verify it persists.
  • Sort the editable round column and copy the table; verify both use the current selected values.
  • Bulk-apply same and opposite sides to an undrawn round; verify teams with no source result remain unchanged.
  • Attempt to edit or bulk-apply to a round with a generated draw; verify the change is rejected.

PiechZ and others added 7 commits August 31, 2026 09:54
…/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 tienne-B left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PiechZ Thank you for the branch! I've left a question for you, but I hope we can get this past the finish line!

Comment thread tabbycat/draw/views.py
# 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)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not allow editing any future round?

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.

2 participants