feat(tournaments): add partnership tracking and tournament management

Implement comprehensive partnership tracking system and tournament
management features including round-robin, single/double elimination,
and Swiss system pairings.

Changes:
- Add partnership_games and partnership_stats tables
- Implement PartnershipTracker service for recording partnership data
- Add tournament generator with multiple formats
- Create tournament management actions and views
- Add acceptance tests for partnership tracking
- Fix PartnershipTracker to use single snapshot per player per match
- Fix round-robin test to query by round_number instead of hardcoded ID

Note: All 8 acceptance tests now passing
This commit is contained in:
2026-03-27 12:25:34 -07:00
parent cb47b9da99
commit ac858f1e6d
55 changed files with 2591 additions and 0 deletions
@@ -0,0 +1,40 @@
<h1>Create New Tournament</h1>
<form action="/admin/tournaments" method="post">
<input type="hidden" name="_csrf_token" value="<%= csrf_token %>">
<div>
<label for="name">Tournament Name *</label>
<input type="text" id="name" name="name" required placeholder="e.g., Spring Championship">
</div>
<div>
<label for="description">Description</label>
<textarea id="description" name="description" rows="3" placeholder="Optional description or rules..."></textarea>
</div>
<div>
<label for="event_date">Date/Time</label>
<input type="datetime-local" id="event_date" name="event_date" value="<%= Time.now.strftime('%Y-%m-%dT%H:%M') %>">
</div>
<div>
<label for="format">Tournament Format</label>
<select id="format" name="format">
<option value="single_elim">Single Elimination</option>
<option value="double_elim">Double Elimination</option>
<option value="round_robin">Round Robin</option>
<option value="swiss">Swiss System</option>
</select>
</div>
<div>
<label for="max_participants">Max Participants (teams)</label>
<input type="number" id="max_participants" name="max_participants" min="2" max="32" placeholder="Optional">
<small>Leave blank for no limit</small>
</div>
<button type="submit">Create Tournament</button>
</form>
<p><a href="/admin/tournaments">Cancel</a></p>