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) {
|
switch (props.match.state) {
|
||||||
case 'in_progress':
|
case 'in_progress':
|
||||||
title = 'Spiel läuft';
|
title = 'Spiel läuft';
|
||||||
|
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>;
|
actionButton = <Button color='primary' onClick={props.endMatch}>Spiel beenden</Button>;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'finished':
|
case 'finished':
|
||||||
title = 'Spiel beendet';
|
title = 'Spiel beendet';
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ function convertTournament(apiTournament) {
|
||||||
} else {
|
} else {
|
||||||
// playoff stage
|
// playoff stage
|
||||||
playoffStages.push({
|
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,
|
id: apiGroup.id,
|
||||||
number: apiGroup.number,
|
number: apiGroup.number,
|
||||||
scores: apiGroup.group_scores,
|
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 = {
|
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) {
|
if (apiMatch.match_scores.length === 2) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue