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,47 @@
<h1><%= tournament.name %> - Round <%= round[:round_number] %></h1>
<p><strong>Status:</strong> <%= round[:status] %></p>
<h2>Matchups</h2>
<% if matchups.any? %>
<table>
<thead>
<tr>
<th>Position</th>
<th>Team 1</th>
<th>vs</th>
<th>Team 2</th>
<th>Winner</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% matchups.each do |matchup| %>
<% team_1 = teams.find { |t| t.id == matchup[:team_1_id] } %>
<% team_2 = teams.find { |t| t.id == matchup[:team_2_id] } %>
<% winner = teams.find { |t| t.id == matchup[:winner_team_id] } %>
<tr>
<td><%= matchup[:bracket_position] %></td>
<td><%= team_1&.team_name || 'BYE' %></td>
<td>vs</td>
<td><%= team_2&.team_name || 'BYE' %></td>
<td><%= winner&.team_name || '-' %></td>
<td>
<% if matchup[:match_id].nil? %>
<a href="/admin/matches/new?event_id=<%= tournament.id %>&team_1_id=<%= matchup[:team_1_id] %>&team_2_id=<%= matchup[:team_2_id] %>">
Create Match
</a>
<% else %>
<a href="/admin/matches/<%= matchup[:match_id] %>">View Match</a>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p>No matchups scheduled for this round.</p>
<% end %>
<p><a href="/admin/tournaments/<%= tournament.id %>">Back to Tournament</a></p>