Fix bug in missed rounds computation

This commit is contained in:
Claude Brisson
2024-01-30 16:31:07 +01:00
parent 727b341521
commit 9e3547fbd9
3 changed files with 3 additions and 3 deletions

View File

@@ -92,7 +92,7 @@ abstract class BasePairingHelper(
val Pairable.sodos: Double get() = historyHelper.sodos[id] ?: 0.0
val Pairable.cums: Double get() = historyHelper.cumScore[id] ?: 0.0
fun Pairable.missedRounds(upToRound: Int, pairing: Set<ID>): Int = (1..upToRound).map { round ->
if (historyHelper.playersPerRound.getOrNull(round - 1)?.contains(id) == true || pairing.contains(id)) 0 else 1
if (historyHelper.playersPerRound.getOrNull(round - 1)?.contains(id) == true || round == upToRound && pairing.contains(id)) 0 else 1
}.sum()
fun Pairable.eval(criterion: Criterion) = evalCriterion(this, criterion)
open fun evalCriterion(pairable: Pairable, criterion: Criterion) = when (criterion) {