sort API now playing games by priority

pull/145/head
Thibault Duplessis 2014-12-16 20:35:18 +01:00
parent f99557b702
commit a938449718
2 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,6 @@
@(povs: List[Pov])(implicit ctx: Context)
@povs.sortBy(Pov.priority).take(9).map { pov =>
@povs.take(9).map { pov =>
<a href="@routes.Round.player(pov.fullId)" class="@if(pov.isMyTurn){my_turn}">
@gameFen(pov.game, pov.color, withLink = false, withTitle = false)
<span class="meta">

View File

@ -117,9 +117,10 @@ object GameRepo {
)))
}
def nowPlaying(user: User): Fu[List[Pov]] = $find(Query nowPlaying user.id) map {
_ flatMap { Pov(_, user) }
}
def nowPlaying(user: User): Fu[List[Pov]] =
$find(Query nowPlaying user.id) map {
_ flatMap { Pov(_, user) } sortBy Pov.priority
}
def setTv(id: ID) {
$update.fieldUnchecked(id, F.tvAt, $date(DateTime.now))