diff --git a/app/controllers/Lobby.scala b/app/controllers/Lobby.scala index ab201377c1..1baa0b15e9 100644 --- a/app/controllers/Lobby.scala +++ b/app/controllers/Lobby.scala @@ -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( diff --git a/modules/simul/src/main/Env.scala b/modules/simul/src/main/Env.scala index 2ae5c1c71b..1ecfa48ff1 100644 --- a/modules/simul/src/main/Env.scala +++ b/modules/simul/src/main/Env.scala @@ -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] diff --git a/modules/simul/src/main/SimulRepo.scala b/modules/simul/src/main/SimulRepo.scala index 7478a8f573..7177719e7d 100644 --- a/modules/simul/src/main/SimulRepo.scala +++ b/modules/simul/src/main/SimulRepo.scala @@ -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]()