From 3c4f04d85c16672519d7125fc9c1506b4ec1309a Mon Sep 17 00:00:00 2001 From: Quentin Rendu Date: Fri, 13 Oct 2023 08:46:55 +0200 Subject: [PATCH] Correct bug in historyBefore and add prints for debugging --- .../org/jeudego/pairgoth/model/Pairing.kt | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 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 ea999f6..37346df 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 @@ -2,8 +2,8 @@ package org.jeudego.pairgoth.model import com.republicate.kson.Json import org.jeudego.pairgoth.api.ApiHandler.Companion.badRequest +import org.jeudego.pairgoth.model.MainCritParams.SeedMethod.SPLIT_AND_SLIP import org.jeudego.pairgoth.model.PairingType.* -import org.jeudego.pairgoth.model.MainCritParams.SeedMethod.* import org.jeudego.pairgoth.pairing.MacMahonSolver import org.jeudego.pairgoth.pairing.SwissSolver @@ -122,8 +122,21 @@ sealed class Pairing( } private fun Tournament<*>.historyBefore(round: Int) = - if (lastRound() == 0) emptyList() - else (0 until round).map { games(round).values.toList() } + if (lastRound() == 1) emptyList() + else (1 until round).map { games(it).values.toList() } + +/*private fun Tournament<*>.historyBefore(round: Int) : List> { + println("Welcome to tournament.historyBefore !") + println("lastround and round = "+lastRound().toString()+" "+round.toString()) + println((1 until round).map { it }) + println((1 until round).map { games(it).values.toList() }) + if (lastRound() == 1){ + return emptyList() + } + else { + return (1 until round).map { games(it).values.toList() } + } +}*/ class Swiss( pairingParams: PairingParams = PairingParams(