diff --git a/CommonCore/SQL/src/de/steamwar/sql/EventGroup.kt b/CommonCore/SQL/src/de/steamwar/sql/EventGroup.kt index 5fb01f30..5db01dbf 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/EventGroup.kt +++ b/CommonCore/SQL/src/de/steamwar/sql/EventGroup.kt @@ -90,7 +90,7 @@ class EventGroup(id: EntityID) : IntEntity(id) { set(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 }) } fun getId() = id.value diff --git a/CommonCore/SQL/src/de/steamwar/sql/EventRelation.kt b/CommonCore/SQL/src/de/steamwar/sql/EventRelation.kt index c1f0e53c..0ca7be22 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/EventRelation.kt +++ b/CommonCore/SQL/src/de/steamwar/sql/EventRelation.kt @@ -117,10 +117,10 @@ class EventRelation(id: EntityID) : IntEntity(id) { fromPlace = place } - fun getAdvancingTeam(): Team? = when(fromType) { + fun getAdvancingTeam(): Team? = useDb { when(fromType) { FromType.FIGHT -> if (fromPlace == 0) fromFight?.winner else fromFight?.losser FromType.GROUP -> fromGroup?.calculatePoints()?.toList()?.sortedBy { (_, v) -> v }?.reversed()?.elementAt(fromPlace)?.first - } + } } fun apply(): Boolean { val team = getAdvancingTeam() ?: return false