From 0fd7aab86c1071350967f49d5edfcfd500930aed Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 30 Nov 2025 17:27:27 +0100 Subject: [PATCH] Fix FightStatistics Signed-off-by: Chaoscaot --- CommonCore/SQL/src/de/steamwar/sql/EventGroup.kt | 2 +- CommonCore/SQL/src/de/steamwar/sql/EventRelation.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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