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() {
|
public Optional<Team> getAdvancingTeam() {
|
||||||
if (fromType == FromType.FIGHT) {
|
if (fromType == FromType.FIGHT) {
|
||||||
if (fromPlace == 1) {
|
if (fromPlace == 0) {
|
||||||
return getFromFight().flatMap(EventFight::getWinner);
|
return getFromFight().flatMap(EventFight::getWinner);
|
||||||
} else {
|
} else {
|
||||||
return getFromFight().flatMap(EventFight::getLosser);
|
return getFromFight().flatMap(EventFight::getLosser);
|
||||||
@@ -141,7 +141,9 @@ public class EventRelation {
|
|||||||
} else if (fromType == FromType.GROUP) {
|
} else if (fromType == FromType.GROUP) {
|
||||||
return getFromGroup().map(EventGroup::calculatePoints)
|
return getFromGroup().map(EventGroup::calculatePoints)
|
||||||
.flatMap(points -> points.entrySet().stream()
|
.flatMap(points -> points.entrySet().stream()
|
||||||
.max(Map.Entry.comparingByValue())
|
.sorted(Map.Entry.comparingByValue())
|
||||||
|
.skip(fromPlace)
|
||||||
|
.findFirst()
|
||||||
.map(Map.Entry::getKey));
|
.map(Map.Entry::getKey));
|
||||||
} else {
|
} else {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
|||||||
Reference in New Issue
Block a user