forked from SteamWar/SteamWar
Adjust advancing team logic in EventRelation to fix fromPlace handling
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user