feature random games when nothing is moving

This commit is contained in:
Thibault Duplessis 2013-07-31 17:21:29 +02:00
parent 82135396b0
commit 2ce04189d2

View file

@ -5,11 +5,11 @@ import scala.concurrent.{ Future, Await }
import akka.actor._
import akka.pattern.ask
import chess.Color
import Featured._
import play.api.Play.current
import play.api.templates.Html
import chess.Color
import lila.db.api._
import tube.gameTube
@ -53,7 +53,11 @@ final class Featured(
private def feature: Fu[Option[Game]] = GameRepo.featuredCandidates map { games
Featured.sort(games filter valid).headOption
} flatMap {
case None GameRepo random 1 map (_.headOption)
case Some(game) fuccess(game.some)
}
}))
}