instanciate analysis replay (TODO: cache) and pass divisions to JS
This commit is contained in:
parent
552789dc97
commit
aa783e24ed
|
@ -57,11 +57,17 @@ object Analyse extends LilaController {
|
|||
(env.analyser get pov.game.id) zip
|
||||
(pov.game.tournamentId ?? lila.tournament.TournamentRepo.byId) zip
|
||||
Env.game.crosstableApi(pov.game) zip
|
||||
(GameRepo initialFen pov.game.id) zip
|
||||
(ctx.isAuth ?? {
|
||||
Env.chat.api.userChat find s"${pov.gameId}/w" map (_.forUser(ctx.me).some)
|
||||
}) map {
|
||||
case (((((version, pgn), analysis), tour), crosstable), chat) => {
|
||||
case ((((((version, pgn), analysis), tour), crosstable), initialFen), chat) => {
|
||||
val opening = gameOpening(pov.game)
|
||||
val replay = chess.Replay(
|
||||
pgn = pov.game.pgnMoves mkString " ",
|
||||
initialFen = initialFen,
|
||||
variant = pov.game.variant
|
||||
).toOption
|
||||
Ok(html.analyse.replay(
|
||||
pov,
|
||||
Env.analyse.annotator(pgn, analysis, opening, pov.game.winnerColor, pov.game.status, pov.game.clock).toString,
|
||||
|
@ -72,7 +78,8 @@ object Analyse extends LilaController {
|
|||
chat,
|
||||
tour,
|
||||
new TimeChart(pov.game, pov.game.pgnMoves),
|
||||
crosstable))
|
||||
crosstable,
|
||||
replay))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@(pov: Pov, pgn: String, opening: Option[chess.OpeningExplorer.Opening], analysis: Option[lila.analyse.Analysis], advantageChart: Option[String], version: Int, chat: Option[lila.chat.UserChat], tour: Option[lila.tournament.Tournament], timeChart: lila.analyse.TimeChart, cross: Option[lila.game.Crosstable])(implicit ctx: Context)
|
||||
@(pov: Pov, pgn: String, opening: Option[chess.OpeningExplorer.Opening], analysis: Option[lila.analyse.Analysis], advantageChart: Option[String], version: Int, chat: Option[lila.chat.UserChat], tour: Option[lila.tournament.Tournament], timeChart: lila.analyse.TimeChart, cross: Option[lila.game.Crosstable], replay: Option[chess.Replay])(implicit ctx: Context)
|
||||
|
||||
@import pov._
|
||||
|
||||
|
@ -114,6 +114,14 @@ openGraph = povOpenGraph(pov)) {
|
|||
@analysis.map { a =>
|
||||
@advantageChart.map { chart =>
|
||||
<div
|
||||
@replay.map { replay =>
|
||||
@chess.Divider(replay) match {
|
||||
case (mid, end) => {
|
||||
data-division-mid="@mid.getOrElse("null")"
|
||||
data-division-end="@end.getOrElse("null")"
|
||||
}
|
||||
}
|
||||
}
|
||||
id="adv_chart"
|
||||
data-title="Advantage (up: white, down: black)"
|
||||
data-max="@lila.analyse.AdvantageChart.max"
|
||||
|
|
Loading…
Reference in a new issue