1
0
Fork 0
mirror of https://codeberg.org/beerbrawl/beerbrawl.git synced 2024-09-22 21:20:52 +02:00

chore(#177): prevent team registration when tournament is already started

This commit is contained in:
motzik 2024-06-26 23:48:07 +02:00 committed by Moritz Kepplinger
parent 18724b992f
commit 8ff0f8f6b9
3 changed files with 7 additions and 1 deletions

View file

@ -62,7 +62,7 @@ public class TournamentTeamServiceImpl implements TournamentTeamService {
throw new BadTournamentPublicAccessTokenException();
}
if (tournament.getRegistrationEnd().isBefore(BeerDateTime.nowUtc())) {
if (tournament.getRegistrationEnd().isBefore(BeerDateTime.nowUtc()) || !tournament.getQualificationMatches().isEmpty()) {
return SignupTeamResult.REGISTRATION_CLOSED;
}

View file

@ -33,6 +33,9 @@
@if (nameFormControl.errors?.maxParticipantsReached) {
<mat-error>No more spots left!</mat-error>
}
@if (nameFormControl.errors?.registrationClosed) {
<mat-error> Registration is closed! </mat-error>
}
</mat-form-field>
<button mat-raised-button type="submit">Sign up!</button>
</form>

View file

@ -80,6 +80,9 @@ export class TeamSignupComponent {
case TournamentSignupTeamResponseDto.SignupTeamResultEnum.MaxParticipantsReached:
this.nameFormControl.setErrors({ maxParticipantsReached: true });
return of();
case TournamentSignupTeamResponseDto.SignupTeamResultEnum.RegistrationClosed:
this.nameFormControl.setErrors({ registrationClosed: true });
return of();
default:
return [];
}