Several bugfixes and finishing touches
This commit is contained in:
@@ -46,7 +46,7 @@ object StandingsHandler: PairgothApiHandler {
|
||||
RANK -> tournament.pairables.mapValues { it.value.rank }
|
||||
RATING -> tournament.pairables.mapValues { it.value.rating }
|
||||
NBW -> historyHelper.wins
|
||||
MMS -> historyHelper.scores
|
||||
MMS -> historyHelper.mms
|
||||
STS -> nullMap
|
||||
CPS -> nullMap
|
||||
|
||||
|
@@ -142,7 +142,10 @@ object OpenGotha {
|
||||
country = player.country,
|
||||
club = player.club
|
||||
).also {
|
||||
canonicMap.put("${player.name}${player.firstName}".uppercase(Locale.ENGLISH), it.id)
|
||||
player.participating.toString().forEachIndexed { i,c ->
|
||||
if (c == '0') it.skip.add(i + 1)
|
||||
}
|
||||
canonicMap.put("${player.name.replace(" ", "")}${player.firstName.replace(" ", "")}".uppercase(Locale.ENGLISH), it.id)
|
||||
}
|
||||
}.associateByTo(tournament.players) { it.id }
|
||||
val gamesPerRound = ogTournament.games.game.groupBy {
|
||||
@@ -155,7 +158,7 @@ object OpenGotha {
|
||||
black = canonicMap[game.blackPlayer] ?: throw Error("player not found: ${game.blackPlayer}"),
|
||||
white = canonicMap[game.whitePlayer] ?: throw Error("player not found: ${game.whitePlayer}"),
|
||||
handicap = game.handicap,
|
||||
result = when (game.result) {
|
||||
result = when (game.result.removeSuffix("_BYDEF")) {
|
||||
"RESULT_UNKNOWN" -> Game.Result.UNKNOWN
|
||||
"RESULT_WHITEWINS" -> Game.Result.WHITE
|
||||
"RESULT_BLACKWINS" -> Game.Result.BLACK
|
||||
|
@@ -15,7 +15,7 @@ open class HistoryHelper(protected val history: List<List<Game>>, scoresGetter:
|
||||
else -> 0.0
|
||||
}
|
||||
|
||||
val scores by lazy {
|
||||
private val scores by lazy {
|
||||
scoresGetter()
|
||||
}
|
||||
|
||||
@@ -76,6 +76,9 @@ open class HistoryHelper(protected val history: List<List<Game>>, scoresGetter:
|
||||
}
|
||||
}
|
||||
|
||||
// define mms to be a synonym of scores
|
||||
val mms by lazy { scores }
|
||||
|
||||
// SOS related functions given a score function
|
||||
val sos by lazy {
|
||||
(history.flatten().map { game ->
|
||||
|
Reference in New Issue
Block a user