From ff7cf47af5b27a9f9ba863088c3386c3a787cdc7 Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Sat, 27 Jan 2024 14:04:57 +0100 Subject: [PATCH] Remove parameters we do not support --- .../org/jeudego/pairgoth/ext/OpenGotha.kt | 27 +++++++++++-------- .../org/jeudego/pairgoth/model/Pairing.kt | 11 +++----- .../src/main/webapp/tour-parameters.inc.html | 0 3 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 view-webapp/src/main/webapp/tour-parameters.inc.html diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt index 3b6f180..bf597d1 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt @@ -50,6 +50,20 @@ object OpenGotha { val placmtParams = ogTournament.tournamentParameterSet.placementParameterSet val pairParams = ogTournament.tournamentParameterSet.pairingParameterSet + // some checks + + if (genParams.genNBW2ValueAbsent.toDouble() != 0.0) { + throw Error("Pairgoth only support 0 for 'NBW for Absent player'") + } + + if (genParams.genNBW2ValueBye.toDouble() != 2.0) { + throw Error("Pairgoth only support 1 for 'NBW for Bye player'") + } + + if (genParams.genMMS2ValueBye.toDouble() != 2.0) { + throw Error("Pairgoth only support 1 for 'MMS for Bye player'") + } + val pairgothPairingParams = PairingParams( base = BaseCritParams( nx1 = pairParams.paiStandardNX1Factor.toDouble(), @@ -71,10 +85,7 @@ object OpenGotha { seedSystem2 = parseSeedSystem(pairParams.paiMaSeedSystem2 ?: "SPLITANDSLIP"), additionalPlacementCritSystem1 = Criterion.valueOf(pairParams.paiMaAdditionalPlacementCritSystem1.uppercase()), additionalPlacementCritSystem2 = Criterion.valueOf(pairParams.paiMaAdditionalPlacementCritSystem2.uppercase().replace("NULL", "NONE")), - nbwValueAbsent = genParams.genNBW2ValueAbsent.toDouble() / 2.0, - nbwValueBye = genParams.genNBW2ValueBye.toDouble() / 2.0, - mmsValueAbsent = genParams.genMMS2ValueAbsent.toDouble() / 2.0, - mmsValueBye = genParams.genMMS2ValueBye.toDouble() / 2.0, + mmsValueAbsent = genParams.genMMS2ValueAbsent.toDouble() / 2.0 ), secondary = SecondaryCritParams( barThresholdActive = pairParams.paiSeBarThresholdActive.toBoolean(), @@ -293,13 +304,7 @@ object OpenGotha { ).uppercase(Locale.ROOT) }" genMMS2ValueAbsent="${ (tournament.pairing.pairingParams.main.mmsValueAbsent * 2).roundToInt() - }" genMMS2ValueBye="${ - (tournament.pairing.pairingParams.main.mmsValueBye * 2).roundToInt() - }" genMMZero="30K" genNBW2ValueAbsent="${ - (tournament.pairing.pairingParams.main.nbwValueAbsent * 2).roundToInt() - }" genNBW2ValueBye="${ - (tournament.pairing.pairingParams.main.nbwValueBye * 2).roundToInt() - }" genRoundDownNBWMMS="true" komi="${tournament.komi}" location="${tournament.location}" name="${tournament.name}" nbMovesCanTime="${tournament.timeSystem.stones}" numberOfCategories="1" numberOfRounds="${tournament.rounds}" shortName="${tournament.shortName}" size="${tournament.gobanSize}" stdByoYomiTime="${tournament.timeSystem.byoyomi}"/> + }" genMMS2ValueBye="2" genMMZero="30K" genNBW2ValueAbsent="0" genNBW2ValueBye="2" genRoundDownNBWMMS="true" komi="${tournament.komi}" location="${tournament.location}" name="${tournament.name}" nbMovesCanTime="${tournament.timeSystem.stones}" numberOfCategories="1" numberOfRounds="${tournament.rounds}" shortName="${tournament.shortName}" size="${tournament.gobanSize}" stdByoYomiTime="${tournament.timeSystem.byoyomi}"/> 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 786f960..e0a2f13 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 @@ -50,10 +50,7 @@ data class MainCritParams( val seedSystem2: SeedMethod = SeedMethod.SPLIT_AND_FOLD, val additionalPlacementCritSystem1: Criterion = Criterion.RATING, val additionalPlacementCritSystem2: Criterion = Criterion.NONE, - val nbwValueAbsent: Double = 0.0, - val nbwValueBye: Double = 1.0, val mmsValueAbsent: Double = 0.5, - val mmsValueBye: Double = 1.0 ) { enum class DrawUpDown { TOP, MIDDLE, BOTTOM } enum class SeedMethod { SPLIT_AND_FOLD, SPLIT_AND_RANDOM, SPLIT_AND_SLIP } @@ -245,10 +242,7 @@ fun MainCritParams.Companion.fromJson(json: Json.Object, localDefault: MainCritP seedSystem2 = json.getString("secondSeed")?.let { MainCritParams.SeedMethod.valueOf(it) } ?: localDefault?.seedSystem2 ?: default.seedSystem2, additionalPlacementCritSystem1 = json.getString("firstSeedAddCrit")?.let { Criterion.valueOf(it) } ?: localDefault?.additionalPlacementCritSystem1 ?: default.additionalPlacementCritSystem1, additionalPlacementCritSystem2 = json.getString("secondSeedAddCrit")?.let { Criterion.valueOf(it) } ?: localDefault?.additionalPlacementCritSystem2 ?: default.additionalPlacementCritSystem2, - nbwValueAbsent = json.getDouble("nbwValueAbsent") ?: localDefault?.nbwValueAbsent ?: default.nbwValueAbsent, - nbwValueBye = json.getDouble("nbwValueBye") ?: localDefault?.nbwValueBye ?: default.nbwValueBye, - mmsValueAbsent = json.getDouble("mmsValueAbsent") ?: localDefault?.mmsValueAbsent ?: default.mmsValueAbsent, - mmsValueBye = json.getDouble("mmsValueBye") ?: localDefault?.mmsValueBye ?: default.mmsValueBye + mmsValueAbsent = json.getDouble("mmsValueAbsent") ?: localDefault?.mmsValueAbsent ?: default.mmsValueAbsent ) fun MainCritParams.toJson() = Json.Object( @@ -263,7 +257,8 @@ fun MainCritParams.toJson() = Json.Object( "firstSeed" to seedSystem1, "secondSeed" to seedSystem2, "firstSeedAddCrit" to additionalPlacementCritSystem1, - "secondSeedAddCrit" to additionalPlacementCritSystem2 + "secondSeedAddCrit" to additionalPlacementCritSystem2, + "mmsValueAbsent" to mmsValueAbsent ) fun SecondaryCritParams.Companion.fromJson(json: Json.Object, localDefault: SecondaryCritParams? = null) = SecondaryCritParams( diff --git a/view-webapp/src/main/webapp/tour-parameters.inc.html b/view-webapp/src/main/webapp/tour-parameters.inc.html new file mode 100644 index 0000000..e69de29