diff --git a/js/components/MatchModal.js b/js/components/MatchModal.js index e2eef0c..9a84a30 100644 --- a/js/components/MatchModal.js +++ b/js/components/MatchModal.js @@ -10,7 +10,11 @@ export function MatchModal(props) { switch (props.match.state) { case 'in_progress': title = 'Spiel läuft'; - actionButton = ; + if (!props.match.allowUndecided && props.match.team1.score === props.match.team2.score) { + actionButton = ; + } else { + actionButton = ; + } break; case 'finished': title = 'Spiel beendet'; diff --git a/pages/tournament.js b/pages/tournament.js index a7bc42e..575e47f 100644 --- a/pages/tournament.js +++ b/pages/tournament.js @@ -94,7 +94,7 @@ function convertTournament(apiTournament) { } else { // playoff stage playoffStages.push({ - id: stage.id, level: stage.level, matches: stage.matches.map(match => convertMatch(match)) + id: stage.id, level: stage.level, matches: stage.matches.map(match => convertMatch(match, false)) }); } } @@ -115,13 +115,14 @@ function convertGroup(apiGroup) { id: apiGroup.id, number: apiGroup.number, scores: apiGroup.group_scores, - matches: apiGroup.matches.map(match => convertMatch(match)) + matches: apiGroup.matches.map(match => convertMatch(match, true)) }; } -function convertMatch(apiMatch) { +function convertMatch(apiMatch, allowUndecided) { const result = { - id: apiMatch.id, state: apiMatch.state, winnerTeamId: apiMatch.winner === null ? null : apiMatch.winner.id + id: apiMatch.id, state: apiMatch.state, allowUndecided: allowUndecided, + winnerTeamId: apiMatch.winner === null ? null : apiMatch.winner.id }; if (apiMatch.match_scores.length === 2) {