From c3bdbde0be3485e185b5ba0c025cb7ed059841f8 Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Sun, 19 Jan 2025 19:41:28 +0100 Subject: [PATCH] Fix mmfloor & mmbar resetting bug --- .../src/main/kotlin/org/jeudego/pairgoth/model/Pairing.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairing.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairing.kt index 420e62a..53489b9 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairing.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairing.kt @@ -330,8 +330,8 @@ fun Pairing.Companion.fromJson(json: Json.Object, default: Pairing?): Pairing { return when (type) { SWISS -> Swiss(pairingParams, placementParams) MAC_MAHON -> MacMahon(pairingParams, placementParams).also { mm -> - mm.mmFloor = json.getInt("mmFloor") ?: -20 - mm.mmBar = json.getInt("mmBar") ?: 0 + mm.mmFloor = json.getInt("mmFloor") ?: (default as? MacMahon)?.mmFloor ?: -20 + mm.mmBar = json.getInt("mmBar") ?: (default as? MacMahon)?.mmBar ?: 0 } ROUND_ROBIN -> RoundRobin(pairingParams, placementParams) }