Fix when no rounds
All checks were successful
Gitea/swiss-backend/pipeline/head This commit looks good

This commit is contained in:
Michel ten Voorde
2025-10-27 14:41:10 +01:00
parent cca133d67c
commit 180d431f8d

View File

@@ -96,12 +96,14 @@ public class TournamentMapper implements DtoMapper<Tournament, TournamentDto>, E
for (var event : tournament.getEvents()) { for (var event : tournament.getEvents()) {
if (event.getGroups() != null) { if (event.getGroups() != null) {
for (var group : event.getGroups()) { for (var group : event.getGroups()) {
for (var round : group.getRounds()) { if (group.getRounds() != null) {
for (var match : round.getMatches()) { for (var round : group.getRounds()) {
if (match.getStatus() == Status.IN_PROGRESS && match.getCounter() != null) { for (var match : round.getMatches()) {
var counter = getTournamentPlayerFromPlayerId(tournament, match.getCounter().getId()); if (match.getStatus() == Status.IN_PROGRESS && match.getCounter() != null) {
if (counter != null) { var counter = getTournamentPlayerFromPlayerId(tournament, match.getCounter().getId());
playersCounting.add(counter.getId()); if (counter != null) {
playersCounting.add(counter.getId());
}
} }
} }
} }
@@ -118,10 +120,12 @@ public class TournamentMapper implements DtoMapper<Tournament, TournamentDto>, E
for (var event : tournament.getEvents()) { for (var event : tournament.getEvents()) {
if (event.getGroups() != null) { if (event.getGroups() != null) {
for (var group : event.getGroups()) { for (var group : event.getGroups()) {
for (var round : group.getRounds()) { if (group.getRounds() != null) {
for (var match : round.getMatches()) { for (var round : group.getRounds()) {
if (match.getStatus() == Status.IN_PROGRESS) { for (var match : round.getMatches()) {
playersPlaying.addAll(getPlayersInMatch(tournament, match)); if (match.getStatus() == Status.IN_PROGRESS) {
playersPlaying.addAll(getPlayersInMatch(tournament, match));
}
} }
} }
} }