Fix tables number export bug

This commit is contained in:
Claude Brisson
2024-01-31 06:01:04 +01:00
parent 7b3d215a0a
commit 0f9afbcc65

View File

@@ -242,11 +242,11 @@ object OpenGotha {
<Games> <Games>
// TODO - table number is not any more kinda random like this // TODO - table number is not any more kinda random like this
${(1..tournament.lastRound()).map { tournament.games(it) }.flatMapIndexed { index, games -> ${(1..tournament.lastRound()).map { tournament.games(it) }.flatMapIndexed { index, games ->
games.values.mapIndexedNotNull { table, game -> games.values.mapNotNull { game ->
if (game.black == 0 || game.white == 0) null if (game.black == 0 || game.white == 0) null
else Triple(index + 1, table , game) else Pair(index + 1, game)
} }
}.joinToString("\n") { (round, table, game) -> }.joinToString("\n") { (round, game) ->
"""<Game blackPlayer="${ """<Game blackPlayer="${
(tournament.pairables[game.black]!! as Player).let { black -> (tournament.pairables[game.black]!! as Player).let { black ->
"${black.name.replace(" ", "")}${black.firstname.replace(" ", "")}".uppercase(Locale.ENGLISH) // Use Locale.ENGLISH to transform é to É "${black.name.replace(" ", "")}${black.firstname.replace(" ", "")}".uppercase(Locale.ENGLISH) // Use Locale.ENGLISH to transform é to É
@@ -263,7 +263,7 @@ object OpenGotha {
}" roundNumber="${ }" roundNumber="${
round round
}" tableNumber="${ }" tableNumber="${
table + 1 game.table
}" whitePlayer="${ }" whitePlayer="${
(tournament.pairables[game.white]!! as Player).let { white -> (tournament.pairables[game.white]!! as Player).let { white ->
"${white.name}${white.firstname}".uppercase(Locale.ENGLISH) // Use Locale.ENGLISH to transform é to É "${white.name}${white.firstname}".uppercase(Locale.ENGLISH) // Use Locale.ENGLISH to transform é to É