diff --git a/frontend/src/views/TournamentsView.vue b/frontend/src/views/TournamentsView.vue index f2004ab..2a9cfad 100644 --- a/frontend/src/views/TournamentsView.vue +++ b/frontend/src/views/TournamentsView.vue @@ -789,9 +789,23 @@ export default { if (b.setsWon !== a.setsWon) return b.setsWon - a.setsWon; return a.name.localeCompare(b.name); }); - rankings[gid] = arr.map((p, i) => ({ - ...p, position: i + 1 - })); + // Weise Positionen zu, wobei Spieler mit identischen Werten den gleichen Platz bekommen + let currentPosition = 1; + rankings[gid] = arr.map((p, i) => { + // Wenn nicht der erste Spieler und die Werte identisch sind, verwende die gleiche Position + if (i > 0) { + const prev = arr[i - 1]; + if (prev.points === p.points && + prev.setDiff === p.setDiff && + prev.setsWon === p.setsWon) { + // Gleicher Platz wie Vorgänger + return { ...p, position: currentPosition }; + } + } + // Neuer Platz + currentPosition = i + 1; + return { ...p, position: currentPosition }; + }); }); return rankings; }, @@ -1701,9 +1715,27 @@ export default { return a.name.localeCompare(b.name); }); + // Weise Positionen zu, wobei Spieler mit identischen Werten den gleichen Platz bekommen + let currentPosition = 1; + const positions = liveStats.map((p, i) => { + // Wenn nicht der erste Spieler und die Werte identisch sind, verwende die gleiche Position + if (i > 0) { + const prev = liveStats[i - 1]; + if (prev.livePoints === p.livePoints && + prev.liveSetDiff === p.liveSetDiff && + prev.liveSetsWon === p.liveSetsWon) { + // Gleicher Platz wie Vorgänger + return currentPosition; + } + } + // Neuer Platz + currentPosition = i + 1; + return currentPosition; + }); + // Finde Position des Spielers - const position = liveStats.findIndex(p => p.id === playerId) + 1; - return position; + const playerIndex = liveStats.findIndex(p => p.id === playerId); + return playerIndex >= 0 ? positions[playerIndex] : liveStats.length + 1; } } };