feat: rework CatPreset for add more detail + add preset

This commit is contained in:
2026-01-21 22:05:58 +01:00
parent 78d22b466d
commit d2a7e6cbac
11 changed files with 440 additions and 158 deletions

View File

@@ -271,10 +271,9 @@ public class CompetitionService {
presetModel.setName(preset.getName());
presetModel.setSwordType(preset.getSword());
presetModel.setShieldType(preset.getShield());
presetModel.setRoundDuration(preset.getRoundDuration());
presetModel.setPauseDuration(preset.getPauseDuration());
presetModel.setCategories(preset.getCategories());
presetModel.setMandatoryProtection(preset.getMandatoryProtection());
presetModel.setMandatoryProtection1(preset.getMandatoryProtection1());
presetModel.setMandatoryProtection2(preset.getMandatoryProtection2());
}
// Remove deleted presets
@@ -399,7 +398,8 @@ public class CompetitionService {
g.getCategoriesInscrites().clear();
g.getCategoriesInscrites().addAll(cats);
g.getCategoriesInscrites()
.removeIf(cat -> !cat.getCategories().contains(g.getCategorie()));
.removeIf(cat -> cat.getCategories().stream()
.noneMatch(e -> e.getCategorie().equals(g.getCategorie())));
}))
.chain(model -> Panache.withTransaction(() -> competitionGuestRepository.persist(model))
.call(r -> model.getCompetition().getSystem() == CompetitionSystem.INTERNAL ?
@@ -495,7 +495,8 @@ public class CompetitionService {
}
r.getCategoriesInscrites().addAll(cats);
r.getCategoriesInscrites()
.removeIf(cat -> !cat.getCategories().contains(r.getCategorie2()));
.removeIf(cat -> cat.getCategories().stream()
.noneMatch(e -> e.getCategorie().equals(r.getCategorie2())));
})))
.chain(r -> Panache.withTransaction(() -> registerRepository.persist(r)))
.call(r -> c.getSystem() == CompetitionSystem.INTERNAL ?