fix puzzle-ui merge

This commit is contained in:
Thibault Duplessis 2016-12-06 12:40:57 +01:00
parent 1b78f74d4c
commit 4582b7efe6
3 changed files with 11 additions and 7 deletions

View file

@ -121,11 +121,7 @@ object Puzzle extends LilaController {
case None =>
lila.mon.puzzle.round.anon()
env.finisher.incPuzzleAttempts(puzzle)
Ok(JsData(puzzle, none, "view",
win = data.isWin.some,
voted = none,
animationDuration = env.AnimationDuration))
}
renderJson(puzzle, none, "view", win = data.isWin.some, voted = none) map { Ok(_) }
}
) map (_ as JSON)
}

View file

@ -40,7 +40,7 @@ object JsonView {
"coords" -> pref.coords,
"rookCastle" -> pref.rookCastle
),
"chessground" -> Json.obj(
"chessground" -> (!isMobileApi).option(Json.obj(
"highlight" -> Json.obj(
"lastMove" -> pref.highlight,
"check" -> pref.highlight
@ -54,7 +54,7 @@ object JsonView {
"premovable" -> Json.obj(
"showDests" -> pref.destination
)
),
)),
"animation" -> Json.obj(
"duration" -> pref.animationFactor * animationDuration.toMillis
),
@ -65,6 +65,13 @@ object JsonView {
"win" -> a.win
)
},
"attempt" -> round.ifTrue(isMobileApi).map { r =>
Json.obj(
"userRatingDiff" -> r.ratingDiff,
"win" -> r.win,
"seconds" -> "a few" // lol we don't have the value anymore
)
},
"win" -> win,
"voted" -> voted,
"user" -> userInfos.map { i =>

View file

@ -355,6 +355,7 @@ lichess.notifyApp = (function() {
else if (lichess.analyse) startAnalyse(document.getElementById('lichess'), lichess.analyse);
else if (lichess.user_analysis) startUserAnalysis(document.getElementById('lichess'), lichess.user_analysis);
else if (lichess.study) startStudy(document.getElementById('lichess'), lichess.study);
else if (lichess.puzzle) startPuzzle(lichess.puzzle);
else if (lichess.tournament) startTournament(document.getElementById('tournament'), lichess.tournament);
else if (lichess.simul) startSimul(document.getElementById('simul'), lichess.simul);