feat: implement variable team matchups with partner rotation

- Add manual team entry for permanent teams in Matchups tab
- Rename 'Teams' tab to 'Matchups' for clarity
- Implement partner rotation strategies (minimize_repeat, maximize_even, elo_based)
- Track partnerships across rounds to minimize repeat pairings
- Fix unit tests for team configuration and ELO calculations
- Add E2E test for 9+ participant tournaments with variable matchups

Key changes:
- TeamsSection.tsx: Added router.refresh(), manual team entry, and matchup display
- schedule-generator.ts: Enhanced generateVariableRoundRobin to track partnerships
- team-generator.ts: Fixed partnership frequency tracking across rounds
- API routes: Updated to support variable team durability with rotation strategies
This commit is contained in:
2026-04-04 00:24:57 -07:00
parent 63ef1d124c
commit 603cc238fa
24 changed files with 3106 additions and 868 deletions
+5
View File
@@ -229,13 +229,18 @@ export async function recalculateAllElo(prisma: PrismaClient) {
};
// Process each match in chronological order
console.log('recalculateAllElo: Starting match processing loop');
for (const match of matches) {
console.log('recalculateAllElo: Processing match', match.id);
const { player1P1, player1P2, player2P1, player2P2, team1Score, team2Score, id: matchId, playedAt } = match;
// Skip matches with missing players
if (!player1P1 || !player1P2 || !player2P1 || !player2P2) {
console.log('recalculateAllElo: Skipping match due to missing players');
continue;
}
console.log('recalculateAllElo: Match has all players, processing...');
// Get current ratings for all players
const p1Rating = getPlayerStats(player1P1.id).rating;