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 399c21a..fa12ee1 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 @@ -92,16 +92,16 @@ data class GeographicalParams( // handicap params data class HandicapParams( // minimizeHandicap is a secondary criteria but moved here - val weight: Double = 0.0, // Should be paiSeDefSecCrit for SwCat, 0 for others + val weight: Double = 0.0, // "Should be paiSeDefSecCrit for SwCat, 0 for others" ; unused for now, swiss with cats not implemented val useMMS: Boolean = true, // if useMMS is false, hd will be based on rank // Maximum rank used to compute handicap is rankThreshold - val rankThreshold: Int = 0, // 0 is 1d + val rankThreshold: Int = 0, // No handicap if at least one player is above this rank (0 is 1d) val correction: Int = 1, // Handicap will be decreased by hdCorrection val ceiling: Int = 9, // Possible values are between 0 and 9 ) { companion object { val swissDefault = HandicapParams( - weight = 0.0, // TODO 'default disables handicap' => seems wrong, not used + weight = 0.0, useMMS = false, rankThreshold = -30, // 30k ceiling = 0) diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/solver/MacMahonSolver.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/solver/MacMahonSolver.kt index bf50bae..761b9c7 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/solver/MacMahonSolver.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/solver/MacMahonSolver.kt @@ -35,9 +35,9 @@ class MacMahonSolver(round: Int, override fun SecondaryCritParams.apply(p1: Pairable, p2: Pairable): Double { - // Do we apply Secondary Criteria. - // No player is above thresholds -> apply secondary criteria - // At least one player is above thresholds -> do not apply + // Do we apply Secondary Criteria? + // - no player is above thresholds -> apply secondary criteria + // - at least one player is above thresholds -> do not apply val nbw2Threshold = if (nbWinsThresholdActive) totalRounds @@ -46,8 +46,10 @@ class MacMahonSolver(round: Int, val skipSecondary = (2 * p1.nbW >= nbw2Threshold) || (2 * p2.nbW >= nbw2Threshold) || - (p1.rank + p1.nbW >= mmBar) || - (p2.rank + p2.nbW >= mmBar) + barThresholdActive && ( + (p1.rank + p1.nbW >= mmBar) || + (p2.rank + p2.nbW >= mmBar) + ) return if (skipSecondary) 0.0 else pairing.geo.apply(p1, p2)