Adjust advancing team logic in EventRelation to fix fromPlace handling

This commit is contained in:
2025-06-26 23:38:19 +02:00
parent 2f93f336c9
commit 1f1f99f8f3
@@ -133,7 +133,7 @@ public class EventRelation {
public Optional<Team> getAdvancingTeam() {
if (fromType == FromType.FIGHT) {
if (fromPlace == 1) {
if (fromPlace == 0) {
return getFromFight().flatMap(EventFight::getWinner);
} else {
return getFromFight().flatMap(EventFight::getLosser);
@@ -141,7 +141,9 @@ public class EventRelation {
} else if (fromType == FromType.GROUP) {
return getFromGroup().map(EventGroup::calculatePoints)
.flatMap(points -> points.entrySet().stream()
.max(Map.Entry.comparingByValue())
.sorted(Map.Entry.comparingByValue())
.skip(fromPlace)
.findFirst()
.map(Map.Entry::getKey));
} else {
return Optional.empty();