improve user leaderboards
This commit is contained in:
parent
00fb927658
commit
65fe56fd38
|
@ -10,12 +10,13 @@ import lila.user.{ User, Context }
|
|||
trait UserHelper { self: I18nHelper with StringHelper ⇒
|
||||
|
||||
def showProgress(progress: Int) = Html {
|
||||
val title = "Rating progression over the last ten games"
|
||||
val span = progress match {
|
||||
case 0 ⇒ s"""<span class="zero">=</span>"""
|
||||
case p if p > 0 ⇒ s"""<span class="positive">$p↗</span>"""
|
||||
case p if p < 0 ⇒ s"""<span class="negative">${math.abs(p)}↘</span>"""
|
||||
}
|
||||
s"""<span class="progress">$span</span>"""
|
||||
s"""<span title="$title" class="progress">$span</span>"""
|
||||
}
|
||||
|
||||
def userIdToUsername(userId: String): String =
|
||||
|
|
|
@ -15,9 +15,18 @@
|
|||
@user.layout(trans.chessPlayers.str(), goodies = goodies.some) {
|
||||
<div class="content_box">
|
||||
<div class="user_lists clearfix">
|
||||
@user.top(progress, "Best progress")(_.rating)
|
||||
@user.top(rating, "Best players ever")(_.rating)
|
||||
@user.top(online, onlineLink, true)(_.rating)
|
||||
@user.top(progress, "Best progress") { u =>
|
||||
<td>@u.rating</td>
|
||||
<td>@showProgress(u.progress)</td>
|
||||
}
|
||||
@user.top(rating, "Best players ever") { u =>
|
||||
<td>@u.rating</td>
|
||||
<td>@showProgress(u.progress)</td>
|
||||
}
|
||||
@user.top(online, onlineLink, true) { u =>
|
||||
<td>@u.rating</td>
|
||||
<td>@showProgress(u.progress)</td>
|
||||
}
|
||||
@user.top(nb, "Active players")(u => s"#${u.count.game.localize}")
|
||||
@user.top(bullet, "Best bullet players")(_.perfs.bullet.glicko.intRating)
|
||||
@user.top(blitz, "Best blitz players", true)(_.perfs.blitz.glicko.intRating)
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
<table>
|
||||
<tbody>
|
||||
@users.map { u =>
|
||||
<tr><td>@userLink(u, withRating = false, withProgress = true, cssClass="revert-underline".some)</td><td>@f(u)</td></tr>
|
||||
<tr>
|
||||
<td>@userLink(u, withRating = false, cssClass="revert-underline".some)</td>
|
||||
<td>@f(u)</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -78,9 +78,9 @@ trait UserRepo {
|
|||
|
||||
val enabledSelect = Json.obj("enabled" -> true)
|
||||
val noEngineSelect = Json.obj("engine" -> $ne(true))
|
||||
val stableRating = Json.obj("perfs.global.gl.d" -> $lt(100))
|
||||
val stableSelect = Json.obj("perfs.global.gl.d" -> $lt(100))
|
||||
val goodLadSelect = enabledSelect ++ noEngineSelect
|
||||
val stableGoodLadSelect = enabledSelect ++ noEngineSelect ++ goodLadSelect
|
||||
val stableGoodLadSelect = stableSelect ++ goodLadSelect
|
||||
val goodLadQuery = $query(goodLadSelect)
|
||||
val stableGoodLadQuery = $query(stableGoodLadSelect)
|
||||
|
||||
|
|
Loading…
Reference in a new issue