forked from SteamWar/SteamWar
@@ -90,7 +90,7 @@ class EventGroup(id: EntityID<Int>) : IntEntity(id) {
|
|||||||
set(value) {
|
set(value) {
|
||||||
groupPointsPerDraw = value
|
groupPointsPerDraw = value
|
||||||
}
|
}
|
||||||
val dependents by lazy { EventRelation.getGroupRelations(this) }
|
val dependents by lazy { EventRelation.getGroupRelations(this).toList() }
|
||||||
val lastFight by lazy { Optional.ofNullable(fights.maxByOrNull { it.startTime }) }
|
val lastFight by lazy { Optional.ofNullable(fights.maxByOrNull { it.startTime }) }
|
||||||
|
|
||||||
fun getId() = id.value
|
fun getId() = id.value
|
||||||
|
|||||||
@@ -117,10 +117,10 @@ class EventRelation(id: EntityID<Int>) : IntEntity(id) {
|
|||||||
fromPlace = place
|
fromPlace = place
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAdvancingTeam(): Team? = when(fromType) {
|
fun getAdvancingTeam(): Team? = useDb { when(fromType) {
|
||||||
FromType.FIGHT -> if (fromPlace == 0) fromFight?.winner else fromFight?.losser
|
FromType.FIGHT -> if (fromPlace == 0) fromFight?.winner else fromFight?.losser
|
||||||
FromType.GROUP -> fromGroup?.calculatePoints()?.toList()?.sortedBy { (_, v) -> v }?.reversed()?.elementAt(fromPlace)?.first
|
FromType.GROUP -> fromGroup?.calculatePoints()?.toList()?.sortedBy { (_, v) -> v }?.reversed()?.elementAt(fromPlace)?.first
|
||||||
}
|
} }
|
||||||
|
|
||||||
fun apply(): Boolean {
|
fun apply(): Boolean {
|
||||||
val team = getAdvancingTeam() ?: return false
|
val team = getAdvancingTeam() ?: return false
|
||||||
|
|||||||
Reference in New Issue
Block a user