feat: add tournament creation wizard with participant management and bulk game entry
This commit is contained in:
@@ -153,6 +153,23 @@ export async function POST(request: Request) {
|
||||
await updatePartnershipStats(players[0].id, players[1].id, team1Won, player1EloChange);
|
||||
await updatePartnershipStats(players[2].id, players[3].id, team2Won, player3EloChange);
|
||||
|
||||
// Add players as participants in the tournament (if not already added)
|
||||
for (const player of players) {
|
||||
try {
|
||||
await prisma.eventParticipant.create({
|
||||
data: {
|
||||
eventId: parseInt(eventId),
|
||||
playerId: player.id,
|
||||
status: "participated",
|
||||
registrationDate: new Date(),
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
// Participant already exists, which is fine
|
||||
console.log(`Participant ${player.id} already exists in tournament ${eventId}`);
|
||||
}
|
||||
}
|
||||
|
||||
importedCount++;
|
||||
} catch (err: any) {
|
||||
errors.push(`Row ${index + 2}: ${err.message}`);
|
||||
|
||||
Reference in New Issue
Block a user