show tournament winners and leaderboard in /players
This commit is contained in:
parent
beb5a4348c
commit
57274c3df4
|
@ -80,29 +80,29 @@ object User extends LilaController {
|
|||
Reasonable(page) {
|
||||
val nb = 10
|
||||
for {
|
||||
progressDay ← env.cached.topProgressDay(nb)
|
||||
progressWeek ← env.cached.topProgressWeek(nb)
|
||||
progressMonth ← env.cached.topProgressMonth(nb)
|
||||
rating ← env.cached.topRating(nb)
|
||||
ratingDay ← env.cached.topRatingDay(nb)
|
||||
ratingWeek ← env.cached.topRatingWeek(nb)
|
||||
online ← env.cached.topOnline(30)
|
||||
bullet ← env.cached.topBullet(nb)
|
||||
blitz ← env.cached.topBlitz(nb)
|
||||
slow ← env.cached.topSlow(nb)
|
||||
active ← env.cached.topNbGame(nb) map2 { (user: UserModel) =>
|
||||
progressDay ← env.cached topProgressDay nb
|
||||
tourneyWinners ← Env.tournament.leaderboard scheduled nb
|
||||
toint <- env.cached topToints nb
|
||||
rating ← env.cached topRating nb
|
||||
ratingDay ← env.cached topRatingDay nb
|
||||
ratingWeek ← env.cached topRatingWeek nb
|
||||
online ← env.cached topOnline 30
|
||||
bullet ← env.cached topBullet nb
|
||||
blitz ← env.cached topBlitz nb
|
||||
slow ← env.cached topSlow nb
|
||||
active ← env.cached topNbGame nb map2 { (user: UserModel) =>
|
||||
user -> user.count.game
|
||||
}
|
||||
activeDay ← Env.game.cached.activePlayerUidsDay(nb) flatMap { pairs =>
|
||||
activeDay ← Env.game.cached activePlayerUidsDay nb flatMap { pairs =>
|
||||
UserRepo.byOrderedIds(pairs.map(_._1)) map (_ zip pairs.map(_._2))
|
||||
}
|
||||
activeWeek ← Env.game.cached.activePlayerUidsWeek(nb) flatMap { pairs =>
|
||||
activeWeek ← Env.game.cached activePlayerUidsWeek nb flatMap { pairs =>
|
||||
UserRepo.byOrderedIds(pairs.map(_._1)) map (_ zip pairs.map(_._2))
|
||||
}
|
||||
} yield html.user.list(
|
||||
progressDay = progressDay,
|
||||
progressWeek = progressWeek,
|
||||
progressMonth = progressMonth,
|
||||
tourneyWinners = tourneyWinners,
|
||||
toint = toint,
|
||||
rating = rating,
|
||||
ratingDay = ratingDay,
|
||||
ratingWeek = ratingWeek,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@(progressDay: List[User], progressWeek: List[User], progressMonth: List[User], rating: List[User], ratingDay: List[User], ratingWeek: List[User], online: List[User], bullet: List[User], blitz: List[User], slow: List[User], nb: List[(User, Int)], nbDay: List[(User, Int)], nbWeek: List[(User, Int)])(implicit ctx: Context)
|
||||
@(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], slow: List[User], nb: List[(User, Int)], nbDay: List[(User, Int)], nbWeek: List[(User, Int)])(implicit ctx: Context)
|
||||
|
||||
@goodies = {
|
||||
<div class="goodies">
|
||||
|
@ -28,22 +28,42 @@
|
|||
|
||||
@user.layout(trans.players.str(), goodies = goodies.some) {
|
||||
<div class="content_box">
|
||||
<div class="user_lists clearfix">
|
||||
@user.topLeader(progressDay, trans.progressToday(), icon = "Q".some)
|
||||
@user.topLeader(ratingDay, trans.todaysLeaders(), icon = "C".some)
|
||||
@user.topActive(nbDay, trans.activeToday(), true, icon = "T".some)
|
||||
<div class="user_lists">
|
||||
|
||||
@user.topLeader(progressWeek, trans.progressThisWeek(), icon = "Q".some)
|
||||
@user.topLeader(ratingWeek, trans.leaderboardThisWeek(), icon = "C".some)
|
||||
@user.topActive(nbWeek, trans.activeThisWeek(), true, icon = "T".some)
|
||||
<div class="group">
|
||||
@user.topLeader(progressDay, trans.progressToday(), icon = "Q".some)
|
||||
@user.topLeader(ratingDay, trans.todaysLeaders(), icon = "C".some)
|
||||
@user.topActive(nbDay, trans.activeToday(), true, icon = "T".some)
|
||||
</div>
|
||||
|
||||
@user.topLeader(progressMonth, trans.progressThisMonth(), icon = "Q".some)
|
||||
@user.topLeader(rating, trans.leaderboard(), moreUrl = routes.User.leaderboard.url.some, icon = "C".some)
|
||||
@user.topActive(nb, trans.activePlayers(), true, icon = "T".some)
|
||||
<div class="group">
|
||||
@user.topLeader(toint, "Tournament leaderboard", icon = "g".some, moreUrl = routes.Tournament.home.url.some)
|
||||
@user.topLeader(ratingWeek, trans.leaderboardThisWeek(), icon = "C".some)
|
||||
@user.topActive(nbWeek, trans.activeThisWeek(), true, icon = "T".some)
|
||||
</div>
|
||||
|
||||
<div class="group">
|
||||
<div class="user_top">
|
||||
<h2 data-icon="g"><a href="@routes.Tournament.home">Tournament winners</a></h2>
|
||||
<table><tbody>
|
||||
@tourneyWinners.map { w =>
|
||||
<tr>
|
||||
<td>@userLink(w.user, withRating = false, cssClass="revert-underline".some)</td>
|
||||
<td><a href="@routes.Tournament.show(w.tour.id)" class="revert-underline">@w.tour.name.replace("Lichess ", "")</a></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody></table>
|
||||
</div>
|
||||
@user.topLeader(rating, trans.leaderboard(), moreUrl = routes.User.leaderboard.url.some, icon = "C".some)
|
||||
@user.topActive(nb, trans.activePlayers(), true, icon = "T".some)
|
||||
</div>
|
||||
|
||||
<div class="group">
|
||||
@user.top(bullet, trans.bestBulletPlayers())(u => Html(s"<td>${u.perfs.bullet.glicko.intRating}</td>"))
|
||||
@user.top(blitz, trans.bestBlitzPlayers())(u => Html(s"<td>${u.perfs.blitz.glicko.intRating}</td>"))
|
||||
@user.top(slow, trans.bestSlowPlayers(), true)(u => Html(s"<td>${u.perfs.slow.glicko.intRating}</td>"))
|
||||
</div>
|
||||
|
||||
@user.top(bullet, trans.bestBulletPlayers())(u => Html(s"<td>${u.perfs.bullet.glicko.intRating}</td>"))
|
||||
@user.top(blitz, trans.bestBlitzPlayers())(u => Html(s"<td>${u.perfs.blitz.glicko.intRating}</td>"))
|
||||
@user.top(slow, trans.bestSlowPlayers(), true)(u => Html(s"<td>${u.perfs.slow.glicko.intRating}</td>"))
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -28,12 +28,6 @@ final class Cached(
|
|||
val topProgressDay = AsyncCache(
|
||||
(nb: Int) => UserRepo.topProgressSince(oneDayAgo, nb),
|
||||
timeToLive = 14 minutes)
|
||||
val topProgressWeek = AsyncCache(
|
||||
(nb: Int) => UserRepo.topProgressSince(oneWeekAgo, nb),
|
||||
timeToLive = 29 minutes)
|
||||
val topProgressMonth = AsyncCache(
|
||||
(nb: Int) => UserRepo.topProgressSince(oneMonthAgo, nb),
|
||||
timeToLive = 27 minutes)
|
||||
val topRatingDay = AsyncCache(
|
||||
(nb: Int) => UserRepo.topRatingSince(oneDayAgo, nb),
|
||||
timeToLive = 13 minutes)
|
||||
|
@ -49,4 +43,8 @@ final class Cached(
|
|||
val topOnline = AsyncCache(
|
||||
(nb: Int) => UserRepo.byIdsSortRating(onlineUserIdMemo.keys, nb),
|
||||
timeToLive = 2 seconds)
|
||||
|
||||
val topToints = AsyncCache(
|
||||
(nb: Int) => UserRepo allSortToints nb,
|
||||
timeToLive = 10 minutes)
|
||||
}
|
||||
|
|
|
@ -34,9 +34,6 @@ trait UserRepo {
|
|||
def topRatingSince(since: DateTime, nb: Int): Fu[List[User]] =
|
||||
$find($query(stableGoodLadSelect ++ perfSince("global", since)) sort sortRatingDesc, nb)
|
||||
|
||||
def topProgress(nb: Int): Fu[List[User]] =
|
||||
$find($query(stableGoodLadSelect) sort sortProgressDesc, nb)
|
||||
|
||||
def topProgressSince(since: DateTime, nb: Int): Fu[List[User]] =
|
||||
$find($query(stableGoodLadSelect ++ minRatingSelect(1500) ++ perfSince("global", since)) sort sortProgressDesc, nb)
|
||||
|
||||
|
|
|
@ -4,6 +4,11 @@ div.user_lists h2 {
|
|||
line-height: 1.5em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
#lichess div.user_lists,
|
||||
#lichess div.user_lists div.group {
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
#lichess div.user_lists div.user_top {
|
||||
float: left;
|
||||
width: 31%;
|
||||
|
|
Loading…
Reference in a new issue