{master} fix PGN export of masters explorer games
parent
51605e46f1
commit
79ed95d366
|
@ -57,10 +57,12 @@ final class PgnDump(
|
||||||
private def gameLightUsers(game: Game): Fu[(Option[LightUser], Option[LightUser])] =
|
private def gameLightUsers(game: Game): Fu[(Option[LightUser], Option[LightUser])] =
|
||||||
(game.whitePlayer.userId ?? lightUserApi.async) zip (game.blackPlayer.userId ?? lightUserApi.async)
|
(game.whitePlayer.userId ?? lightUserApi.async) zip (game.blackPlayer.userId ?? lightUserApi.async)
|
||||||
|
|
||||||
private def rating(p: Player) = p.rating.fold("?")(_.toString)
|
private def rating(p: Player) = p.rating.orElse(p.nameSplit.flatMap(_._2)).fold("?")(_.toString)
|
||||||
|
|
||||||
def player(p: Player, u: Option[LightUser]) =
|
def player(p: Player, u: Option[LightUser]) =
|
||||||
p.aiLevel.fold(u.fold(p.name | lila.user.User.anonymous)(_.name))("lichess AI level " + _)
|
p.aiLevel.fold(u.fold(p.nameSplit.map(_._1).orElse(p.name) | lila.user.User.anonymous)(_.name))(
|
||||||
|
"lichess AI level " + _
|
||||||
|
)
|
||||||
|
|
||||||
private val customStartPosition: Set[chess.variant.Variant] =
|
private val customStartPosition: Set[chess.variant.Variant] =
|
||||||
Set(chess.variant.Chess960, chess.variant.FromPosition, chess.variant.Horde, chess.variant.RacingKings)
|
Set(chess.variant.Chess960, chess.variant.FromPosition, chess.variant.Horde, chess.variant.RacingKings)
|
||||||
|
|
|
@ -60,8 +60,8 @@ case class Player(
|
||||||
|
|
||||||
def nameSplit: Option[(String, Option[Int])] =
|
def nameSplit: Option[(String, Option[Int])] =
|
||||||
name map {
|
name map {
|
||||||
case Player.nameSplitRegex(n, r) => n -> r.toIntOption
|
case Player.nameSplitRegex(n, r) => n.trim -> r.toIntOption
|
||||||
case n => n -> none
|
case n => n -> none
|
||||||
}
|
}
|
||||||
|
|
||||||
def before(other: Player) =
|
def before(other: Player) =
|
||||||
|
|
Loading…
Reference in New Issue