improve puzzles according to community feedback

pull/83/head
Thibault Duplessis 2014-02-09 14:36:57 +01:00
parent 12ae90c5fc
commit a2b098ad7c
11 changed files with 44 additions and 28 deletions

View File

@ -42,7 +42,7 @@ object Puzzle extends LilaController {
OptionFuOk(env.api.puzzle find id) { puzzle
(ctx.userId ?? { env.api.attempt.find(puzzle.id, _) }) zip
(env userInfos ctx.me) map {
case (attempt, infos) views.html.puzzle.viewMode(puzzle, attempt, infos)
case (attempt, infos) views.html.puzzle.viewMode(puzzle, attempt, infos, false)
}
}
}
@ -57,7 +57,7 @@ object Puzzle extends LilaController {
case None env.finisher.anon(puzzle, data) inject none
}) flatMap { attempt
env.api.puzzle find id zip (env userInfos ctx.me) map {
case (Some(p2), infos) Ok(views.html.puzzle.viewMode(p2, attempt, infos))
case (Some(p2), infos) Ok(views.html.puzzle.viewMode(p2, attempt, infos, true))
case _ NotFound
}
}

View File

@ -22,7 +22,7 @@ final class SiteMenu(trans: I18nKeys) {
val message = new Elem("message", routes.Message.inbox(page = 1), trans.inbox)
private val authenticated = List(play, game, puzzle, tournament, user, team, forum, tv)
private val anonymous = List(play, game, tournament, user, team, forum, tv)
private val anonymous = List(play, game, puzzle, tournament, user, team, forum, tv)
def all(me: Option[User]) = me match {
case Some(me) authenticated

View File

@ -18,7 +18,7 @@
</td>
<td>
<a class="user_link" href="@routes.Puzzle.show(attempt.puzzleId)">
Puzzle #@attempt.puzzleId
Puzzle @attempt.puzzleId
(@attempt.puzzleRating)
</a>
</td>

View File

@ -3,6 +3,6 @@
@layout("Puzzle") {
<div id="puzzle_wrap">
@viewMode(puzzle, attempt, userInfos)
@viewMode(puzzle, attempt, userInfos, false)
</div>
}

View File

@ -1,4 +1,4 @@
@(puzzle: lila.puzzle.Puzzle, attempt: Option[lila.puzzle.Attempt], userInfos: Option[lila.puzzle.UserInfos])(implicit ctx: Context)
@(puzzle: lila.puzzle.Puzzle, attempt: Option[lila.puzzle.Attempt], userInfos: Option[lila.puzzle.UserInfos], inSession: Boolean)(implicit ctx: Context)
<div id="puzzle"
data-mode="view"
@ -51,7 +51,13 @@
<small title="Glicko rating deviation"> ±@puzzle.perf.glicko.intDeviationDoubled</small>
</p>
<p>
Played <strong>@puzzle.attempts</strong> times
Played <strong>
@puzzle.attempts match {
case 1 => { once }
case 2 => { twice }
case x => { @x times }
}
</strong>
</p>
<p>
Win rate: <strong>@puzzle.winPercent</strong>%
@ -60,7 +66,13 @@
Average time: <strong>@showMillis(puzzle.time)</strong> seconds
</p>
</div>
<button class="continue button">&#9654; Continue training</button>
<div class="continue_wrap">
@if(inSession) {
<button class="continue button">Continue training &#9654;</button>
} else {
<a class="continue button" href="@routes.Puzzle.home">Start training &#9654;</a>
}
</div>
</div>
</div>

View File

@ -1,6 +1,6 @@
@(puzzle: lila.puzzle.Puzzle, attempt: Option[lila.puzzle.Attempt])
<div class="upvote @if(attempt.isDefined) { enabled }"
<div title="Popularity" class="upvote @if(attempt.isDefined) { enabled }"
data-post-url="@routes.Puzzle.vote(puzzle.id)">
<a data-vote="1" class="upvote @if(attempt.flatMap(_.vote) == Some(true)) { active }"></a>
<span class="count">@puzzle.vote.sum</span>

View File

@ -69,7 +69,7 @@
(core/center-right! ($ :.right $puzzle))
(core/user-chart! ($ :.user_chart $puzzle))
(bind-vote! ($ :div.vote_wrap $puzzle))
(bind-continue! ($ :.continue $puzzle))
(bind-continue! ($ :button.continue $puzzle))
(bind-browse! $browse)
(go
(loop [step (count progress) animate false]

View File

@ -52,6 +52,14 @@ GET /games/imported controllers.Game.imported(page: Int ?= 1)
# Search
GET /games/search controllers.Game.search(page: Int ?= 1)
# Puzzle
GET /training controllers.Puzzle.home
GET /training/new controllers.Puzzle.newPuzzle
GET /training/:id controllers.Puzzle.show(id: Int)
GET /training/:id/view controllers.Puzzle.view(id: Int)
POST /training/:id/attempt controllers.Puzzle.attempt(id: Int)
POST /training/:id/vote controllers.Puzzle.vote(id: Int)
# Round
GET /$gameId<[\w\-]{8}> controllers.Round.watcher(gameId: String, color: String = "white")
GET /$gameId<[\w\-]{8}>/$color<white|black> controllers.Round.watcher(gameId: String, color: String)
@ -206,21 +214,13 @@ GET /report/thanks controllers.Report.thanks
GET /report/list controllers.Report.list
POST /report/:id/process controllers.Report.process(id: String)
# Puzzle
POST /api/puzzle controllers.Puzzle.importBatch
GET /training controllers.Puzzle.home
GET /training/new controllers.Puzzle.newPuzzle
GET /training/:id controllers.Puzzle.show(id: Int)
GET /training/:id/view controllers.Puzzle.view(id: Int)
POST /training/:id/attempt controllers.Puzzle.attempt(id: Int)
POST /training/:id/vote controllers.Puzzle.vote(id: Int)
# API
POST /api/game/new controllers.Setup.api
GET /api/user controllers.Api.users
GET /api/user/:id controllers.Api.user(id: String)
GET /api/game controllers.Api.games
GET /api/analysis controllers.Api.analysis
POST /api/puzzle controllers.Puzzle.importBatch
# Misc
POST /cli controllers.Cli.command

View File

@ -1538,7 +1538,8 @@ div.pagination span.current,
div.progressbar.flashy div,
.button.strong:hover,
div.locale_menu a.active,
#import_game .progression {
#import_game .progression,
#puzzle .continue {
color: #fff;
background: #d85000;
background: linear-gradient(to bottom, #d85000, #c84000);

View File

@ -71,9 +71,13 @@
font-size: 1.3em;
margin-bottom: 10px;
}
#puzzle > .right > .continue {
display: block;
margin: 20px auto 0 auto;
#puzzle > .right > .continue_wrap {
width: 100%;
text-align: center;
margin-top: 20px;
}
#puzzle > .right .continue {
display: inline-block;
white-space: nowrap;
font-size: 1.3em;
font-weight: bold;
@ -100,14 +104,13 @@
float: right;
}
#puzzle div.upvote a {
cursor: normal;
cursor: default;
}
#puzzle div.upvote.enabled a {
cursor: pointer;
}
#puzzle div.upvote a {
background: url('../images/vote.png');
overflow: hidden;
display: block;
margin: 0 auto;
width: 40px;

6
todo
View File

@ -55,7 +55,6 @@ replace move green glow with simple border (chess.com) skwex on #chess
opening tree http://www.shredderchess.com/online-chess/online-databases/opening-database.html
data visualisation with http://app.raw.densitydesign.org/
tournament elo restriction
open analysis to anon (with IP restriction)
analysis always show best move
analysis infer ! and !! from evaluation at depth
no challenge when playing http://en.lichess.org/forum/lichess-feedback/defis#2
@ -80,7 +79,6 @@ premove choose promotion http://en.lichess.org/forum/lichess-feedback/premove-pr
teams sorted by ELO http://en.lichess.org/forum/lichess-feedback/average-team-elo#1
analysis bug http://en.lichess.org/forum/lichess-feedback/blunders-in-computer-analysis#1
improve AI cheat detection (not only game start)
can't search for anon games
user profile tab for imported games http://en.lichess.org/inbox/zevof2tu#bottom
analysis board (see chess.com)
watcher game sounds only on first color
@ -117,7 +115,9 @@ puzzle letters outside
show points won/lost in view mode
view mode chart doesn't show last attempt
one-time introduction to puzzle "Find the best move for white"
right-align "continue" arrow (+color?)
more sounds http://en.lichess.org/forum/lichess-feedback/play-a-sound-when-a-game-is-beginning#1
puzzle stats page
check play-RM dependency (prismic?)
deploy
------