Use (Light)Pov.gameId
parent
1e3e12f833
commit
7b3124b0cf
|
@ -30,10 +30,10 @@ object Analyse extends LilaController {
|
||||||
|
|
||||||
def replay(pov: Pov, userTv: Option[lila.user.User])(implicit ctx: Context) =
|
def replay(pov: Pov, userTv: Option[lila.user.User])(implicit ctx: Context) =
|
||||||
if (HTTPRequest isBot ctx.req) replayBot(pov)
|
if (HTTPRequest isBot ctx.req) replayBot(pov)
|
||||||
else GameRepo initialFen pov.game.id flatMap { initialFen =>
|
else GameRepo initialFen pov.gameId flatMap { initialFen =>
|
||||||
Game.preloadUsers(pov.game) >> RedirectAtFen(pov, initialFen) {
|
Game.preloadUsers(pov.game) >> RedirectAtFen(pov, initialFen) {
|
||||||
(env.analyser get pov.game.id) zip
|
(env.analyser get pov.gameId) zip
|
||||||
Env.fishnet.api.prioritaryAnalysisInProgress(pov.game.id) zip
|
Env.fishnet.api.prioritaryAnalysisInProgress(pov.gameId) zip
|
||||||
(pov.game.simulId ?? Env.simul.repo.find) zip
|
(pov.game.simulId ?? Env.simul.repo.find) zip
|
||||||
Round.getWatcherChat(pov.game) zip
|
Round.getWatcherChat(pov.game) zip
|
||||||
Env.game.crosstableApi.withMatchup(pov.game) zip
|
Env.game.crosstableApi.withMatchup(pov.game) zip
|
||||||
|
@ -96,8 +96,8 @@ object Analyse extends LilaController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private def replayBot(pov: Pov)(implicit ctx: Context) = for {
|
private def replayBot(pov: Pov)(implicit ctx: Context) = for {
|
||||||
initialFen <- GameRepo initialFen pov.game.id
|
initialFen <- GameRepo initialFen pov.gameId
|
||||||
analysis <- env.analyser get pov.game.id
|
analysis <- env.analyser get pov.gameId
|
||||||
simul <- pov.game.simulId ?? Env.simul.repo.find
|
simul <- pov.game.simulId ?? Env.simul.repo.find
|
||||||
crosstable <- Env.game.crosstableApi.withMatchup(pov.game)
|
crosstable <- Env.game.crosstableApi.withMatchup(pov.game)
|
||||||
pgn <- Env.api.pgnDump(pov.game, initialFen, PgnDump.WithFlags(clocks = false))
|
pgn <- Env.api.pgnDump(pov.game, initialFen, PgnDump.WithFlags(clocks = false))
|
||||||
|
|
|
@ -63,7 +63,7 @@ object Challenge extends LilaController {
|
||||||
OptionFuResult(env.api byId id) { c =>
|
OptionFuResult(env.api byId id) { c =>
|
||||||
isForMe(c) ?? env.api.accept(c, ctx.me).flatMap {
|
isForMe(c) ?? env.api.accept(c, ctx.me).flatMap {
|
||||||
case Some(pov) => negotiate(
|
case Some(pov) => negotiate(
|
||||||
html = Redirect(routes.Round.watcher(pov.game.id, "white")).fuccess,
|
html = Redirect(routes.Round.watcher(pov.gameId, "white")).fuccess,
|
||||||
api = apiVersion => Env.api.roundApi.player(pov, apiVersion) map { Ok(_) }
|
api = apiVersion => Env.api.roundApi.player(pov, apiVersion) map { Ok(_) }
|
||||||
) flatMap withChallengeAnonCookie(ctx.isAnon, c, false)
|
) flatMap withChallengeAnonCookie(ctx.isAnon, c, false)
|
||||||
case None => negotiate(
|
case None => negotiate(
|
||||||
|
|
|
@ -96,7 +96,7 @@ object Round extends LilaController with TheftPrevention {
|
||||||
private def otherPovs(game: GameModel)(implicit ctx: Context) = ctx.me ?? { user =>
|
private def otherPovs(game: GameModel)(implicit ctx: Context) = ctx.me ?? { user =>
|
||||||
GameRepo urgentGames user map {
|
GameRepo urgentGames user map {
|
||||||
_ filter { pov =>
|
_ filter { pov =>
|
||||||
pov.game.id != game.id && pov.game.isSwitchable && pov.game.isSimul == game.isSimul
|
pov.gameId != game.id && pov.game.isSwitchable && pov.game.isSimul == game.isSimul
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,13 +183,13 @@ object Round extends LilaController with TheftPrevention {
|
||||||
Ok(html.round.watcher(pov, data, tour, simul, crosstable, userTv = userTv, chatOption = chat, bookmarked = bookmarked))
|
Ok(html.round.watcher(pov, data, tour, simul, crosstable, userTv = userTv, chatOption = chat, bookmarked = bookmarked))
|
||||||
}
|
}
|
||||||
else for { // web crawlers don't need the full thing
|
else for { // web crawlers don't need the full thing
|
||||||
initialFen <- GameRepo.initialFen(pov.game.id)
|
initialFen <- GameRepo.initialFen(pov.gameId)
|
||||||
pgn <- Env.api.pgnDump(pov.game, initialFen, PgnDump.WithFlags(clocks = false))
|
pgn <- Env.api.pgnDump(pov.game, initialFen, PgnDump.WithFlags(clocks = false))
|
||||||
} yield Ok(html.round.watcherBot(pov, initialFen, pgn))
|
} yield Ok(html.round.watcherBot(pov, initialFen, pgn))
|
||||||
}.mon(_.http.response.watcher.website),
|
}.mon(_.http.response.watcher.website),
|
||||||
api = apiVersion => for {
|
api = apiVersion => for {
|
||||||
data <- Env.api.roundApi.watcher(pov, apiVersion, tv = none)
|
data <- Env.api.roundApi.watcher(pov, apiVersion, tv = none)
|
||||||
analysis <- pov.game.metadata.analysed.??(analyser get pov.game.id)
|
analysis <- pov.game.metadata.analysed.??(analyser get pov.gameId)
|
||||||
chat <- getWatcherChat(pov.game)
|
chat <- getWatcherChat(pov.game)
|
||||||
} yield Ok {
|
} yield Ok {
|
||||||
data
|
data
|
||||||
|
|
|
@ -207,7 +207,7 @@ object Setup extends LilaController with TheftPrevention {
|
||||||
|
|
||||||
private[controllers] def redirectPov(pov: Pov)(implicit ctx: Context) = {
|
private[controllers] def redirectPov(pov: Pov)(implicit ctx: Context) = {
|
||||||
implicit val req = ctx.req
|
implicit val req = ctx.req
|
||||||
val redir = Redirect(routes.Round.watcher(pov.game.id, "white"))
|
val redir = Redirect(routes.Round.watcher(pov.gameId, "white"))
|
||||||
if (ctx.isAuth) redir
|
if (ctx.isAuth) redir
|
||||||
else redir withCookies LilaCookie.cookie(
|
else redir withCookies LilaCookie.cookie(
|
||||||
AnonCookie.name,
|
AnonCookie.name,
|
||||||
|
|
|
@ -136,7 +136,7 @@ object Tournament extends LilaController {
|
||||||
|
|
||||||
def userGameNbShow(id: String, user: String, nb: Int) = Open { implicit ctx =>
|
def userGameNbShow(id: String, user: String, nb: Int) = Open { implicit ctx =>
|
||||||
withUserGameNb(id, user, nb) { pov =>
|
withUserGameNb(id, user, nb) { pov =>
|
||||||
Redirect(routes.Round.watcher(pov.game.id, pov.color.name))
|
Redirect(routes.Round.watcher(pov.gameId, pov.color.name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ object UserAnalysis extends LilaController with TheftPrevention {
|
||||||
}
|
}
|
||||||
|
|
||||||
private def mobileAnalysis(pov: Pov, apiVersion: lila.common.ApiVersion)(implicit ctx: Context): Fu[Result] =
|
private def mobileAnalysis(pov: Pov, apiVersion: lila.common.ApiVersion)(implicit ctx: Context): Fu[Result] =
|
||||||
GameRepo initialFen pov.game.id flatMap { initialFen =>
|
GameRepo initialFen pov.gameId flatMap { initialFen =>
|
||||||
Game.preloadUsers(pov.game) zip
|
Game.preloadUsers(pov.game) zip
|
||||||
(Env.analyse.analyser get pov.game) zip
|
(Env.analyse.analyser get pov.game) zip
|
||||||
Env.game.crosstableApi(pov.game) zip
|
Env.game.crosstableApi(pov.game) zip
|
||||||
|
|
|
@ -76,7 +76,7 @@ object Preload {
|
||||||
pov = pov,
|
pov = pov,
|
||||||
opponent = opponent,
|
opponent = opponent,
|
||||||
json = Json.obj(
|
json = Json.obj(
|
||||||
"id" -> pov.game.id,
|
"id" -> pov.gameId,
|
||||||
"color" -> pov.color.name,
|
"color" -> pov.color.name,
|
||||||
"opponent" -> opponent
|
"opponent" -> opponent
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,9 +17,9 @@ trait GameHelper { self: I18nHelper with UserHelper with AiHelper with StringHel
|
||||||
def cdnUrl(path: String): String
|
def cdnUrl(path: String): String
|
||||||
|
|
||||||
def povOpenGraph(pov: Pov) = lila.app.ui.OpenGraph(
|
def povOpenGraph(pov: Pov) = lila.app.ui.OpenGraph(
|
||||||
image = cdnUrl(routes.Export.png(pov.game.id).url).some,
|
image = cdnUrl(routes.Export.png(pov.gameId).url).some,
|
||||||
title = titleGame(pov.game),
|
title = titleGame(pov.game),
|
||||||
url = s"$netBaseUrl${routes.Round.watcher(pov.game.id, pov.color.name).url}",
|
url = s"$netBaseUrl${routes.Round.watcher(pov.gameId, pov.color.name).url}",
|
||||||
description = describePov(pov)
|
description = describePov(pov)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -228,12 +228,12 @@ trait GameHelper { self: I18nHelper with UserHelper with AiHelper with StringHel
|
||||||
def gameFenNoCtx(pov: Pov, tv: Boolean = false, blank: Boolean = false) = Html {
|
def gameFenNoCtx(pov: Pov, tv: Boolean = false, blank: Boolean = false) = Html {
|
||||||
val isLive = pov.game.isBeingPlayed
|
val isLive = pov.game.isBeingPlayed
|
||||||
val variant = pov.game.variant.key
|
val variant = pov.game.variant.key
|
||||||
s"""<a href="%s%s" title="%s" class="mini_board mini_board_${pov.game.id} parse_fen is2d %s $variant" data-live="%s" data-color="%s" data-fen="%s" data-lastmove="%s"%s>$miniBoardContent</a>""".format(
|
s"""<a href="%s%s" title="%s" class="mini_board mini_board_${pov.gameId} parse_fen is2d %s $variant" data-live="%s" data-color="%s" data-fen="%s" data-lastmove="%s"%s>$miniBoardContent</a>""".format(
|
||||||
blank ?? netBaseUrl,
|
blank ?? netBaseUrl,
|
||||||
tv.fold(routes.Tv.index, routes.Round.watcher(pov.game.id, pov.color.name)),
|
tv.fold(routes.Tv.index, routes.Round.watcher(pov.gameId, pov.color.name)),
|
||||||
gameTitle(pov.game, pov.color),
|
gameTitle(pov.game, pov.color),
|
||||||
isLive ?? ("live live_" + pov.game.id),
|
isLive ?? ("live live_" + pov.gameId),
|
||||||
isLive ?? pov.game.id,
|
isLive ?? pov.gameId,
|
||||||
pov.color.name,
|
pov.color.name,
|
||||||
Forsyth exportBoard pov.game.board,
|
Forsyth exportBoard pov.game.board,
|
||||||
~pov.game.lastMoveKeys,
|
~pov.game.lastMoveKeys,
|
||||||
|
|
|
@ -106,7 +106,7 @@ case (pt, score) => {
|
||||||
@scoreHtml(score)
|
@scoreHtml(score)
|
||||||
<div class="sub">
|
<div class="sub">
|
||||||
@povs.map { pov =>
|
@povs.map { pov =>
|
||||||
<a class="glpt" href="@routes.Round.watcher(pov.game.id, pov.color.name)">
|
<a class="glpt" href="@routes.Round.watcher(pov.gameId, pov.color.name)">
|
||||||
@pov.game.wonBy(pov.color) match {
|
@pov.game.wonBy(pov.color) match {
|
||||||
case Some(true) => {Victory}
|
case Some(true) => {Victory}
|
||||||
case Some(false) => {Defeat}
|
case Some(false) => {Defeat}
|
||||||
|
|
|
@ -108,7 +108,7 @@ private[api] final class RoundApi(
|
||||||
|
|
||||||
private def withTree(pov: Pov, analysis: Option[Analysis], initialFen: Option[FEN], withFlags: WithFlags)(obj: JsObject) =
|
private def withTree(pov: Pov, analysis: Option[Analysis], initialFen: Option[FEN], withFlags: WithFlags)(obj: JsObject) =
|
||||||
obj + ("treeParts" -> partitionTreeJsonWriter.writes(lila.round.TreeBuilder(
|
obj + ("treeParts" -> partitionTreeJsonWriter.writes(lila.round.TreeBuilder(
|
||||||
id = pov.game.id,
|
id = pov.gameId,
|
||||||
pgnMoves = pov.game.pgnMoves,
|
pgnMoves = pov.game.pgnMoves,
|
||||||
variant = pov.game.variant,
|
variant = pov.game.variant,
|
||||||
analysis = analysis,
|
analysis = analysis,
|
||||||
|
@ -119,7 +119,7 @@ private[api] final class RoundApi(
|
||||||
|
|
||||||
private def withSteps(pov: Pov, initialFen: Option[FEN])(obj: JsObject) =
|
private def withSteps(pov: Pov, initialFen: Option[FEN])(obj: JsObject) =
|
||||||
obj + ("steps" -> lila.round.StepBuilder(
|
obj + ("steps" -> lila.round.StepBuilder(
|
||||||
id = pov.game.id,
|
id = pov.gameId,
|
||||||
pgnMoves = pov.game.pgnMoves,
|
pgnMoves = pov.game.pgnMoves,
|
||||||
variant = pov.game.variant,
|
variant = pov.game.variant,
|
||||||
initialFen = initialFen.fold(pov.game.variant.initialFen)(_.value)
|
initialFen = initialFen.fold(pov.game.variant.initialFen)(_.value)
|
||||||
|
|
|
@ -89,7 +89,7 @@ final class ChallengeApi(
|
||||||
color = (!pov.color).name,
|
color = (!pov.color).name,
|
||||||
challenger = Right(challenger),
|
challenger = Right(challenger),
|
||||||
destUser = Some(destUser),
|
destUser = Some(destUser),
|
||||||
rematchOf = pov.game.id.some
|
rematchOf = pov.gameId.some
|
||||||
)) inject true
|
)) inject true
|
||||||
}
|
}
|
||||||
} yield success
|
} yield success
|
||||||
|
|
|
@ -101,11 +101,9 @@ object PlayerRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
case class LightPov(game: LightGame, color: Color) {
|
case class LightPov(game: LightGame, color: Color) {
|
||||||
|
def gameId = game.id
|
||||||
def player = game player color
|
def player = game player color
|
||||||
|
|
||||||
def opponent = game player !color
|
def opponent = game player !color
|
||||||
|
|
||||||
def win = game wonBy color
|
def win = game wonBy color
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ object Chart {
|
||||||
|
|
||||||
def games = povs.map { pov =>
|
def games = povs.map { pov =>
|
||||||
Json.obj(
|
Json.obj(
|
||||||
"id" -> pov.game.id,
|
"id" -> pov.gameId,
|
||||||
"fen" -> (chess.format.Forsyth exportBoard pov.game.board),
|
"fen" -> (chess.format.Forsyth exportBoard pov.game.board),
|
||||||
"color" -> pov.player.color.name,
|
"color" -> pov.player.color.name,
|
||||||
"lastMove" -> ~pov.game.lastMoveKeys,
|
"lastMove" -> ~pov.game.lastMoveKeys,
|
||||||
|
|
|
@ -33,7 +33,7 @@ case class Entry(
|
||||||
|
|
||||||
case object Entry {
|
case object Entry {
|
||||||
|
|
||||||
def povToId(pov: Pov) = pov.game.id + pov.color.letter
|
def povToId(pov: Pov) = pov.gameId + pov.color.letter
|
||||||
|
|
||||||
object BSONFields {
|
object BSONFields {
|
||||||
val id = "_id"
|
val id = "_id"
|
||||||
|
|
|
@ -122,7 +122,7 @@ object PovToEntry {
|
||||||
!board.hasPiece(chess.Piece(color, chess.Queen))
|
!board.hasPiece(chess.Piece(color, chess.Queen))
|
||||||
}
|
}
|
||||||
case _ =>
|
case _ =>
|
||||||
logger.warn(s"https://lichess.org/${from.pov.game.id} missing endgame board")
|
logger.warn(s"https://lichess.org/${from.pov.gameId} missing endgame board")
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ private[lobby] final class AbortListener(seekApi: SeekApi) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private def recreateSeek(pov: Pov): Funit = pov.player.userId ?? { aborterId =>
|
private def recreateSeek(pov: Pov): Funit = pov.player.userId ?? { aborterId =>
|
||||||
seekApi.findArchived(pov.game.id) flatMap {
|
seekApi.findArchived(pov.gameId) flatMap {
|
||||||
_ ?? { seek =>
|
_ ?? { seek =>
|
||||||
(seek.user.id != aborterId) ?? {
|
(seek.user.id != aborterId) ?? {
|
||||||
worthRecreating(seek) flatMap {
|
worthRecreating(seek) flatMap {
|
||||||
|
|
|
@ -154,7 +154,7 @@ object RatingAt {
|
||||||
pov.player.stableRatingAfter.filter { r =>
|
pov.player.stableRatingAfter.filter { r =>
|
||||||
cur.fold(true) { c => r.compare(c.int) == comp }
|
cur.fold(true) { c => r.compare(c.int) == comp }
|
||||||
}.map {
|
}.map {
|
||||||
RatingAt(_, pov.game.movedAt, pov.game.id)
|
RatingAt(_, pov.game.movedAt, pov.gameId)
|
||||||
} orElse cur
|
} orElse cur
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ case class Results(results: List[Result]) extends AnyVal {
|
||||||
opInt,
|
opInt,
|
||||||
UserId(~pov.opponent.userId),
|
UserId(~pov.opponent.userId),
|
||||||
pov.game.movedAt,
|
pov.game.movedAt,
|
||||||
pov.game.id
|
pov.gameId
|
||||||
) :: results).sortBy(_.opInt * comp) take Results.nb
|
) :: results).sortBy(_.opInt * comp) take Results.nb
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ private final class PushApi(
|
||||||
|
|
||||||
private def corresGameJson(pov: Pov, typ: String) = Json.obj(
|
private def corresGameJson(pov: Pov, typ: String) = Json.obj(
|
||||||
"type" -> typ,
|
"type" -> typ,
|
||||||
"gameId" -> pov.game.id,
|
"gameId" -> pov.gameId,
|
||||||
"fullId" -> pov.fullId,
|
"fullId" -> pov.fullId,
|
||||||
"color" -> pov.color.name,
|
"color" -> pov.color.name,
|
||||||
"fen" -> Forsyth.exportBoard(pov.game.board),
|
"fen" -> Forsyth.exportBoard(pov.game.board),
|
||||||
|
|
|
@ -267,9 +267,9 @@ final class Env(
|
||||||
|
|
||||||
def resign(pov: Pov): Unit = {
|
def resign(pov: Pov): Unit = {
|
||||||
if (pov.game.abortable)
|
if (pov.game.abortable)
|
||||||
roundMap ! Tell(pov.game.id, actorApi.round.Abort(pov.playerId))
|
roundMap ! Tell(pov.gameId, actorApi.round.Abort(pov.playerId))
|
||||||
else if (pov.game.playable)
|
else if (pov.game.playable)
|
||||||
roundMap ! Tell(pov.game.id, actorApi.round.Resign(pov.playerId))
|
roundMap ! Tell(pov.gameId, actorApi.round.Resign(pov.playerId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ final class ForecastApi(coll: Coll, roundMap: akka.actor.ActorSelection) {
|
||||||
if (!pov.isMyTurn) funit
|
if (!pov.isMyTurn) funit
|
||||||
else Uci.Move(uciMove).fold[Funit](fufail(s"Invalid move $uciMove on $pov")) { uci =>
|
else Uci.Move(uciMove).fold[Funit](fufail(s"Invalid move $uciMove on $pov")) { uci =>
|
||||||
val promise = Promise[Unit]
|
val promise = Promise[Unit]
|
||||||
roundMap ! Tell(pov.game.id, actorApi.round.HumanPlay(
|
roundMap ! Tell(pov.gameId, actorApi.round.HumanPlay(
|
||||||
playerId = pov.playerId,
|
playerId = pov.playerId,
|
||||||
uci = uci,
|
uci = uci,
|
||||||
blur = true,
|
blur = true,
|
||||||
|
|
|
@ -55,7 +55,7 @@ final class JsonView(
|
||||||
initialFen: Option[FEN],
|
initialFen: Option[FEN],
|
||||||
withFlags: WithFlags
|
withFlags: WithFlags
|
||||||
): Fu[JsObject] =
|
): Fu[JsObject] =
|
||||||
getSocketStatus(pov.game.id) zip
|
getSocketStatus(pov.gameId) zip
|
||||||
(pov.opponent.userId ?? UserRepo.byId) zip
|
(pov.opponent.userId ?? UserRepo.byId) zip
|
||||||
canTakeback(pov.game) map {
|
canTakeback(pov.game) map {
|
||||||
case ((socket, opponentUser), takebackable) =>
|
case ((socket, opponentUser), takebackable) =>
|
||||||
|
@ -144,7 +144,7 @@ final class JsonView(
|
||||||
initialFen: Option[FEN] = None,
|
initialFen: Option[FEN] = None,
|
||||||
withFlags: WithFlags
|
withFlags: WithFlags
|
||||||
) =
|
) =
|
||||||
getSocketStatus(pov.game.id) zip
|
getSocketStatus(pov.gameId) zip
|
||||||
UserRepo.pair(pov.player.userId, pov.opponent.userId) map {
|
UserRepo.pair(pov.player.userId, pov.opponent.userId) map {
|
||||||
case (socket, (playerUser, opponentUser)) =>
|
case (socket, (playerUser, opponentUser)) =>
|
||||||
import pov._
|
import pov._
|
||||||
|
|
|
@ -54,7 +54,7 @@ private[round] final class Rematcher(
|
||||||
_ ← (GameRepo insertDenormalized nextGame) >>
|
_ ← (GameRepo insertDenormalized nextGame) >>
|
||||||
GameRepo.saveNext(pov.game, nextGame.id) >>-
|
GameRepo.saveNext(pov.game, nextGame.id) >>-
|
||||||
messenger.system(pov.game, _.rematchOfferAccepted) >>- {
|
messenger.system(pov.game, _.rematchOfferAccepted) >>- {
|
||||||
if (pov.game.variant == Chess960 && !rematch960Cache.get(pov.game.id))
|
if (pov.game.variant == Chess960 && !rematch960Cache.get(pov.gameId))
|
||||||
rematch960Cache.put(nextGame.id)
|
rematch960Cache.put(nextGame.id)
|
||||||
}
|
}
|
||||||
} yield {
|
} yield {
|
||||||
|
@ -74,7 +74,7 @@ private[round] final class Rematcher(
|
||||||
situation = initialFen flatMap Forsyth.<<<
|
situation = initialFen flatMap Forsyth.<<<
|
||||||
pieces = pov.game.variant match {
|
pieces = pov.game.variant match {
|
||||||
case Chess960 =>
|
case Chess960 =>
|
||||||
if (rematch960Cache.get(pov.game.id)) Chess960.pieces
|
if (rematch960Cache.get(pov.gameId)) Chess960.pieces
|
||||||
else situation.fold(Chess960.pieces)(_.situation.board.pieces)
|
else situation.fold(Chess960.pieces)(_.situation.board.pieces)
|
||||||
case FromPosition => situation.fold(Standard.pieces)(_.situation.board.pieces)
|
case FromPosition => situation.fold(Standard.pieces)(_.situation.board.pieces)
|
||||||
case variant => variant.pieces
|
case variant => variant.pieces
|
||||||
|
|
|
@ -156,7 +156,7 @@ private[round] final class SocketHandler(
|
||||||
Handler(hub, socket, uid, join) {
|
Handler(hub, socket, uid, join) {
|
||||||
case Connected(enum, member) =>
|
case Connected(enum, member) =>
|
||||||
// register to the TV channel when watching TV
|
// register to the TV channel when watching TV
|
||||||
if (playerId.isEmpty && isRecentTv(pov.game.id)) hub.channel.tvSelect ! lila.socket.Channel.Sub(member)
|
if (playerId.isEmpty && isRecentTv(pov.gameId)) hub.channel.tvSelect ! lila.socket.Channel.Sub(member)
|
||||||
(controller(pov.gameId, chatSetup, socket, uid, pov.ref, member, user), enum, member)
|
(controller(pov.gameId, chatSetup, socket, uid, pov.ref, member, user), enum, member)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ private[setup] final class Processor(
|
||||||
val pov = config pov ctx.me
|
val pov = config pov ctx.me
|
||||||
saveConfig(_ withAi config) >>
|
saveConfig(_ withAi config) >>
|
||||||
(GameRepo insertDenormalized pov.game) >>-
|
(GameRepo insertDenormalized pov.game) >>-
|
||||||
onStart(pov.game.id) >> {
|
onStart(pov.gameId) >> {
|
||||||
pov.game.player.isAi ?? fishnetPlayer(pov.game)
|
pov.game.player.isAi ?? fishnetPlayer(pov.game)
|
||||||
} inject pov
|
} inject pov
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ private final class ChapterMaker(
|
||||||
Chapter.Name(Namer.gameVsText(pov.game, withRatings = false)(lightUser.sync))
|
Chapter.Name(Namer.gameVsText(pov.game, withRatings = false)(lightUser.sync))
|
||||||
else data.name,
|
else data.name,
|
||||||
setup = Chapter.Setup(
|
setup = Chapter.Setup(
|
||||||
!pov.game.synthetic option pov.game.id,
|
!pov.game.synthetic option pov.gameId,
|
||||||
pov.game.variant,
|
pov.game.variant,
|
||||||
data.realOrientation
|
data.realOrientation
|
||||||
),
|
),
|
||||||
|
|
|
@ -39,12 +39,12 @@ private final class StudyMaker(
|
||||||
|
|
||||||
private def createFromPov(data: StudyMaker.Data, pov: Pov, initialFen: Option[FEN], user: User): Fu[Study.WithChapter] =
|
private def createFromPov(data: StudyMaker.Data, pov: Pov, initialFen: Option[FEN], user: User): Fu[Study.WithChapter] =
|
||||||
chapterMaker.game2root(pov.game, initialFen) map { root =>
|
chapterMaker.game2root(pov.game, initialFen) map { root =>
|
||||||
val study = Study.make(user, Study.From.Game(pov.game.id), data.id, Study.Name("Game study").some)
|
val study = Study.make(user, Study.From.Game(pov.gameId), data.id, Study.Name("Game study").some)
|
||||||
val chapter: Chapter = Chapter.make(
|
val chapter: Chapter = Chapter.make(
|
||||||
studyId = study.id,
|
studyId = study.id,
|
||||||
name = Chapter.Name(Namer.gameVsText(pov.game, withRatings = false)(lightUser)),
|
name = Chapter.Name(Namer.gameVsText(pov.game, withRatings = false)(lightUser)),
|
||||||
setup = Chapter.Setup(
|
setup = Chapter.Setup(
|
||||||
gameId = pov.game.id.some,
|
gameId = pov.gameId.some,
|
||||||
variant = pov.game.variant,
|
variant = pov.game.variant,
|
||||||
orientation = pov.color
|
orientation = pov.color
|
||||||
),
|
),
|
||||||
|
|
|
@ -131,7 +131,7 @@ final class JsonView(
|
||||||
.add("withdraw" -> player.withdraw),
|
.add("withdraw" -> player.withdraw),
|
||||||
"pairings" -> povScores.map {
|
"pairings" -> povScores.map {
|
||||||
case (pov, score) => Json.obj(
|
case (pov, score) => Json.obj(
|
||||||
"id" -> pov.game.id,
|
"id" -> pov.gameId,
|
||||||
"color" -> pov.color.name,
|
"color" -> pov.color.name,
|
||||||
"op" -> gameUserJson(pov.opponent.userId, pov.opponent.rating),
|
"op" -> gameUserJson(pov.opponent.userId, pov.opponent.rating),
|
||||||
"win" -> pov.win,
|
"win" -> pov.win,
|
||||||
|
|
Loading…
Reference in New Issue