Merge pull request #30 from turniere/ticket/TURNIERE-221

Check for invalid inputs before applying new group size
This commit is contained in:
betanummeric 2019-05-28 23:30:09 +02:00 committed by GitHub
commit 54e4eb901e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -163,6 +163,11 @@ class CreateTournamentForm extends React.Component {
handleGroupSizeInput(input) {
const newSize = input.target.value;
if (newSize === undefined || newSize < 2) {
return;
}
if (newSize <= this.state.groupAdvance) {
this.setState({
groupSize: newSize, groupAdvance: newSize - 1
@ -173,7 +178,14 @@ class CreateTournamentForm extends React.Component {
}
handleGroupAdvanceInput(input) {
this.setState({groupAdvance: input.target.value});
const newAdvance = input.target.value;
if (newAdvance === undefined || newAdvance <= 0 ||
newAdvance >= this.state.groupSize) {
return;
}
this.setState({groupAdvance: newAdvance});
}
handleGroupPhaseEnabledInput(input) {