Fix sos & co display

This commit is contained in:
Claude Brisson
2024-09-29 19:59:42 +02:00
parent 3b4bd61eb2
commit 0f7c6dfadf

View File

@@ -39,20 +39,26 @@ fun Tournament<*>.getSortedPairables(round: Int, includePreliminary: Boolean = f
// CB TODO - factorize history helper creation between here and solver classes // CB TODO - factorize history helper creation between here and solver classes
val historyHelper = HistoryHelper(historyBefore(round + 1)) { val historyHelper = HistoryHelper(historyBefore(round + 1)) {
if (pairing.type == PairingType.SWISS) wins.mapValues { Pair(0.0, it.value) } if (pairing.type == PairingType.SWISS) {
else pairables.mapValues { pairables.mapValues {
it.value.let { pairable -> Pair(0.0, wins[it.key] ?: 0.0)
val mmBase = pairable.mmBase() }
val score = roundScore(mmBase + }
(nbW(pairable) ?: 0.0) + else {
(1..round).map { round -> pairables.mapValues {
if (playersPerRound.getOrNull(round - 1)?.contains(pairable.id) == true) 0.0 else 1.0 it.value.let { pairable ->
}.sum() * pairing.pairingParams.main.mmsValueAbsent) val mmBase = pairable.mmBase()
Pair( val score = roundScore(mmBase +
if (pairing.pairingParams.main.sosValueAbsentUseBase) mmBase (nbW(pairable) ?: 0.0) +
else roundScore(mmBase + round/2), (1..round).map { round ->
score if (playersPerRound.getOrNull(round - 1)?.contains(pairable.id) == true) 0.0 else 1.0
) }.sum() * pairing.pairingParams.main.mmsValueAbsent)
Pair(
if (pairing.pairingParams.main.sosValueAbsentUseBase) mmBase
else roundScore(mmBase + round/2),
score
)
}
} }
} }
} }