Disable end-match-button if the scores are equal and the match is in playoff stage
This commit is contained in:
parent
5826a06ab6
commit
78e511f228
|
|
@ -10,7 +10,11 @@ export function MatchModal(props) {
|
|||
switch (props.match.state) {
|
||||
case 'in_progress':
|
||||
title = 'Spiel läuft';
|
||||
actionButton = <Button color='primary' onClick={props.endMatch}>Spiel beenden</Button>;
|
||||
if (!props.match.allowUndecided && props.match.team1.score === props.match.team2.score) {
|
||||
actionButton = <Button color='primary' disabled>Spiel beenden</Button>;
|
||||
} else {
|
||||
actionButton = <Button color='primary' onClick={props.endMatch}>Spiel beenden</Button>;
|
||||
}
|
||||
break;
|
||||
case 'finished':
|
||||
title = 'Spiel beendet';
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue