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

Merge branch 'fix/#177/prevent-team-registration-when-tournament-is-started' into 'development'

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

Closes #177

See merge request 2024ss-se-pr-group/24ss-se-pr-qse-11!139
This commit is contained in:
Moritz Kepplinger 2024-06-26 22:33:21 +00:00
commit 4ea5e9fd59
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 [];
}