only feature simuls whose host rating is >= 1700

This commit is contained in:
Thibault Duplessis 2015-04-23 00:22:54 +02:00
parent 37684166aa
commit 7096fbd6ca
3 changed files with 9 additions and 1 deletions

View file

@ -31,7 +31,7 @@ object Lobby extends LilaController {
Env.current.preloader(
posts = Env.forum.recent(ctx.me, Env.team.cached.teamIds),
tours = Env.tournament promotable true,
simuls = Env.simul allCreated true
simuls = Env.simul allCreatedFeaturable true
) map (html.lobby.home.apply _).tupled map { template =>
// the session cookie is required for anon lobby filter storage
ctx.req.session.data.contains(LilaCookie.sessionId).fold(

View file

@ -97,6 +97,8 @@ final class Env(
val allCreated = lila.memo.AsyncCache.single(repo.allCreated, timeToLive = CreatedCacheTtl)
val allCreatedFeaturable = lila.memo.AsyncCache.single(repo.allCreatedFeaturable, timeToLive = CreatedCacheTtl)
def version(tourId: String): Fu[Int] =
socketHub ? Ask(tourId, GetVersion) mapTo manifest[Int]

View file

@ -57,6 +57,12 @@ private[simul] final class SimulRepo(simulColl: Coll) {
createdSelect
).sort(createdSort).cursor[Simul].collect[List]()
def allCreatedFeaturable: Fu[List[Simul]] = simulColl.find(
createdSelect ++ BSONDocument(
"hostRating" -> BSONDocument("$gte" -> 1700)
)
).sort(createdSort).cursor[Simul].collect[List]()
def allStarted: Fu[List[Simul]] = simulColl.find(
startedSelect
).sort(createdSort).cursor[Simul].collect[List]()