Correctly import opengotha bye players
This commit is contained in:
@@ -181,6 +181,7 @@ object OpenGotha {
|
|||||||
canonicMap.put("${player.name.replace(" ", "")}${player.firstName.replace(" ", "")}".uppercase(Locale.ENGLISH), it.id)
|
canonicMap.put("${player.name.replace(" ", "")}${player.firstName.replace(" ", "")}".uppercase(Locale.ENGLISH), it.id)
|
||||||
}
|
}
|
||||||
}.associateByTo(tournament.players) { it.id }
|
}.associateByTo(tournament.players) { it.id }
|
||||||
|
// import games
|
||||||
val gamesPerRound = ogTournament.games.game.groupBy {
|
val gamesPerRound = ogTournament.games.game.groupBy {
|
||||||
it.roundNumber
|
it.roundNumber
|
||||||
}.entries.sortedBy { it.key }.map {
|
}.entries.sortedBy { it.key }.map {
|
||||||
@@ -206,6 +207,16 @@ object OpenGotha {
|
|||||||
gamesPerRound.forEachIndexed { index, games ->
|
gamesPerRound.forEachIndexed { index, games ->
|
||||||
tournament.games(index + 1).putAll(games)
|
tournament.games(index + 1).putAll(games)
|
||||||
}
|
}
|
||||||
|
// import bye players
|
||||||
|
if (ogTournament.byePlayers != null) {
|
||||||
|
for (byePlayer in ogTournament.byePlayers.byePlayer) {
|
||||||
|
val playerId = canonicMap[byePlayer.player] ?: throw Error("player not found: ${byePlayer.player}")
|
||||||
|
val round = byePlayer.roundNumber
|
||||||
|
val game = Game(id = nextGameId, table = 0, white = playerId, black = 0, result = Game.Result.WHITE)
|
||||||
|
tournament.games(round)[game.id] = game
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return tournament
|
return tournament
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -56,7 +56,7 @@
|
|||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
<xs:complexType name="ByePlayersType">
|
<xs:complexType name="ByePlayersType">
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element type="ByePlayerType" name="ByePlayer"/>
|
<xs:element type="ByePlayerType" name="ByePlayer" maxOccurs="unbounded" minOccurs="0"/>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
<xs:complexType name="GeneralParameterSetType">
|
<xs:complexType name="GeneralParameterSetType">
|
||||||
|
Reference in New Issue
Block a user