remove more global ratings, show 1+0 pool leaderboard
parent
1183cad800
commit
3277969d7a
|
@ -52,7 +52,7 @@ drop me an email at thibault.duplessis@gmail.com, and we'll discuss it.
|
|||
{
|
||||
"username": "thibault",
|
||||
"url": "http://lichess.org/@/thibault", // profile url
|
||||
"rating": 1503, // global Glicko2 rating
|
||||
"rating": 1503, // standard Glicko2 rating
|
||||
"progress": 36, // rating change over the last ten games
|
||||
"online": true, // is the player currently using lichess?
|
||||
"playing": "http://lichess.org/abcdefgh", // game being played, if any
|
||||
|
@ -93,7 +93,7 @@ name | type | default | description
|
|||
{
|
||||
"username": "thibault",
|
||||
"url": "http://lichess.org/@/thibault", // profile url
|
||||
"rating": 1503, // global Glicko2 rating
|
||||
"rating": 1503, // standard Glicko2 rating
|
||||
"progress": 36, // rating change over the last ten games
|
||||
"online": true, // is the player currently using lichess?
|
||||
"engine": false // true if the user is known to use a chess engine
|
||||
|
|
|
@ -95,7 +95,7 @@ object User extends LilaController {
|
|||
Reasonable(page) {
|
||||
val nb = 10
|
||||
for {
|
||||
progressDay ← fuccess(Nil)
|
||||
pool10 ← env.cached topPool1_0 nb
|
||||
tourneyWinners ← Env.tournament.winners scheduled nb
|
||||
toint <- env.cached topToints nb
|
||||
rating ← env.cached topRating nb
|
||||
|
@ -115,7 +115,7 @@ object User extends LilaController {
|
|||
UserRepo.byOrderedIds(pairs.map(_._1)) map (_ zip pairs.map(_._2))
|
||||
}
|
||||
} yield html.user.list(
|
||||
progressDay = progressDay,
|
||||
pool10 = pool10,
|
||||
tourneyWinners = tourneyWinners,
|
||||
toint = toint,
|
||||
rating = rating,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@(progressDay: List[User], tourneyWinners: List[lila.tournament.Winner], toint: List[User], rating: List[User], ratingDay: List[User], ratingWeek: List[User], online: List[User], bullet: List[User], blitz: List[User], classical: List[User], nb: List[(User, Int)], nbDay: List[(User, Int)], nbWeek: List[(User, Int)])(implicit ctx: Context)
|
||||
@(pool10: List[User], tourneyWinners: List[lila.tournament.Winner], toint: List[User], rating: List[User], ratingDay: List[User], ratingWeek: List[User], online: List[User], bullet: List[User], blitz: List[User], classical: List[User], nb: List[(User, Int)], nbDay: List[(User, Int)], nbWeek: List[(User, Int)])(implicit ctx: Context)
|
||||
|
||||
@side = {
|
||||
<div class="side">
|
||||
|
@ -31,7 +31,7 @@
|
|||
<div class="user_lists">
|
||||
|
||||
<div class="group">
|
||||
@user.topLeader(progressDay, trans.progressToday(), icon = "Q".some)
|
||||
@user.topLeader(pool10, "1+0 Pool leaderboard", icon = "8".some)
|
||||
@user.topLeader(ratingDay, trans.todaysLeaders(), icon = "C".some)
|
||||
@user.topActive(nbDay, trans.activeToday(), true, icon = "T".some)
|
||||
</div>
|
||||
|
|
|
@ -186,7 +186,7 @@ Set-Cookie: lila2="3b5cc8c80f0af258a31dc4fd1b5381cabe7388c7-sessionId=80q7V5stkK
|
|||
"id": "thibault",
|
||||
"username": "thibault"
|
||||
"title": null,
|
||||
"rating": 1438, // shortcut to global perf rating
|
||||
"rating": 1438, // shortcut to standard perf rating
|
||||
"progress": -55, // rating progress over last 10 games
|
||||
"count": { // number of games played
|
||||
"ai": 256,
|
||||
|
|
|
@ -31,6 +31,8 @@ final class Cached(
|
|||
val topBullet = AsyncCache(UserRepo.topBullet, timeToLive = 31 minutes)
|
||||
val topBlitz = AsyncCache(UserRepo.topBlitz, timeToLive = 32 minutes)
|
||||
val topClassical = AsyncCache(UserRepo.topClassical, timeToLive = 33 minutes)
|
||||
val topChess960 = AsyncCache(UserRepo.topChess960, timeToLive = 36 minutes)
|
||||
val topPool1_0 = AsyncCache(UserRepo.topPool1_0, timeToLive = 31 minutes)
|
||||
val topNbGame = AsyncCache(UserRepo.topNbGame, timeToLive = 34 minutes)
|
||||
|
||||
val topPool = AsyncCache(
|
||||
|
|
|
@ -20,7 +20,7 @@ private[user] final class Ranking(ttl: Duration) {
|
|||
private def compute: Fu[Map[String, Int]] =
|
||||
$primitive(
|
||||
UserRepo.stableGoodLadSelect ++
|
||||
UserRepo.perfSince("global", maxInactivityDate) ++
|
||||
UserRepo.perfSince("standard", maxInactivityDate) ++
|
||||
Json.obj("rating" -> $gt(Glicko.default.intRating)),
|
||||
"_id",
|
||||
_ sort UserRepo.sortRatingDesc
|
||||
|
|
|
@ -31,15 +31,19 @@ trait UserRepo {
|
|||
|
||||
def topRating(nb: Int): Fu[List[User]] = topRatingSince(maxInactivityDate, nb)
|
||||
|
||||
def topRatingSince(since: DateTime, nb: Int): Fu[List[User]] =
|
||||
$find($query(stableGoodLadSelect ++ perfSince("global", since)) sort sortRatingDesc, nb)
|
||||
def topRatingSince(since: DateTime, nb: Int, sincePerf: String = "standard"): Fu[List[User]] =
|
||||
$find($query(stableGoodLadSelect ++ perfSince(sincePerf, since)) sort sortRatingDesc, nb)
|
||||
|
||||
def topBullet = topPerf("bullet") _
|
||||
def topBlitz = topPerf("blitz") _
|
||||
def topClassical = topPerf("classical") _
|
||||
|
||||
def topChess960 = topPerf("chess960") _
|
||||
|
||||
def topPool1_0 = topPerf("pools.1-0") _
|
||||
|
||||
def topPerf(perf: String)(nb: Int): Fu[List[User]] =
|
||||
$find($query(stableGoodLadSelect) sort ($sort desc s"perfs.$perf.gl.r"), nb)
|
||||
$find($query(stableGoodLadSelect ++ activeSelect(perf)) sort ($sort desc s"perfs.$perf.gl.r"), nb)
|
||||
|
||||
def topPool(poolId: String, nb: Int): Fu[List[User]] =
|
||||
$find($query(
|
||||
|
@ -140,8 +144,8 @@ trait UserRepo {
|
|||
|
||||
val enabledSelect = Json.obj(F.enabled -> true)
|
||||
def engineSelect(v: Boolean) = Json.obj(F.engine -> v.fold(JsBoolean(true), $ne(true)))
|
||||
val stableSelect = Json.obj("perfs.global.nb" -> $gte(50))
|
||||
val activeSelect = perfSince("global", DateTime.now minusMonths 2)
|
||||
val stableSelect = Json.obj("perfs.standard.nb" -> $gte(50))
|
||||
def activeSelect(sincePerf: String = "standard") = perfSince(sincePerf, DateTime.now minusMonths 2)
|
||||
val goodLadSelect = enabledSelect ++ engineSelect(false)
|
||||
val stableGoodLadSelect = stableSelect ++ goodLadSelect
|
||||
def minRatingSelect(rating: Int) = Json.obj(F.rating -> $gt(rating))
|
||||
|
|
Loading…
Reference in New Issue