don't show started private tournaments

This commit is contained in:
Thibault Duplessis 2014-12-29 22:58:10 +01:00
parent 4a0542393f
commit 1e4dbd6061
2 changed files with 4 additions and 1 deletions

View file

@ -47,7 +47,7 @@ object Tournament extends LilaController {
}
private def fetchTournaments =
env allCreatedSorted true zip repo.started zip repo.finished(30)
env allCreatedSorted true zip repo.noPasswordStarted zip repo.finished(20)
def show(id: String) = Open { implicit ctx =>
repo byId id flatMap {

View file

@ -44,6 +44,9 @@ object TournamentRepo {
def started: Fu[List[Started]] =
coll.find(startedSelect).sort(BSONDocument("createdAt" -> -1)).toList[Started](None)
def noPasswordStarted: Fu[List[Started]] =
coll.find(startedSelect ++ BSONDocument("password" -> BSONDocument("$exists" -> false))).sort(BSONDocument("createdAt" -> -1)).toList[Started](None)
def finished(limit: Int): Fu[List[Finished]] =
coll.find(finishedSelect).sort(BSONDocument("startedAt" -> -1)).toList[Finished](limit.some)