diff --git a/cd b/cd new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/components/tournament/TournamentGroupsTab.vue b/frontend/src/components/tournament/TournamentGroupsTab.vue index d31809a..395efc3 100644 --- a/frontend/src/components/tournament/TournamentGroupsTab.vue +++ b/frontend/src/components/tournament/TournamentGroupsTab.vue @@ -346,11 +346,14 @@ export default { return classItem ? Boolean(classItem.isDoubles) : false; }, getMatchLiveResult(player1Id, player2Id, groupId) { + const id1 = (m) => m.player1?.id ?? m.player1Id; + const id2 = (m) => m.player2?.id ?? m.player2Id; const match = this.matches.find(m => m.round === 'group' && m.groupId === groupId && - ((m.player1.id === player1Id && m.player2.id === player2Id) || - (m.player1.id === player2Id && m.player2.id === player1Id)) + id1(m) != null && id2(m) != null && + ((id1(m) === player1Id && id2(m) === player2Id) || + (id1(m) === player2Id && id2(m) === player1Id)) ); if (!match) return null; @@ -410,13 +413,13 @@ export default { const playerMatches = this.matches.filter(m => m.round === 'group' && m.groupId === groupId && - (m.player1.id === player.id || m.player2.id === player.id) && + ((m.player1?.id ?? m.player1Id) === player.id || (m.player2?.id ?? m.player2Id) === player.id) && !m.isFinished && m.tournamentResults && m.tournamentResults.length > 0 ); playerMatches.forEach(match => { - const isPlayer1 = match.player1.id === player.id; + const isPlayer1 = (match.player1?.id ?? match.player1Id) === player.id; match.tournamentResults.forEach(result => { if (isPlayer1) { if (result.pointsPlayer1 > result.pointsPlayer2) { @@ -457,12 +460,15 @@ export default { handleMatchClick(player1Id, player2Id, groupId) { // Highlight das Match this.$emit('highlight-match', player1Id, player2Id, groupId); - // Finde das Match und gehe zum Ergebnistab + // Finde das Match und gehe zum Ergebnistab (player1/player2 können null sein, wenn Spieler gelöscht) + const id1 = (m) => m.player1?.id ?? m.player1Id; + const id2 = (m) => m.player2?.id ?? m.player2Id; const match = this.matches.find(m => m.round === 'group' && m.groupId === groupId && - ((m.player1.id === player1Id && m.player2.id === player2Id) || - (m.player1.id === player2Id && m.player2.id === player1Id)) + id1(m) != null && id2(m) != null && + ((id1(m) === player1Id && id2(m) === player2Id) || + (id1(m) === player2Id && id2(m) === player1Id)) ); if (match) { this.$emit('go-to-match', match.id);