code golf

deepcrayonfish^2
Thibault Duplessis 2021-11-29 11:33:28 +01:00
parent 3f23193601
commit 06e1261dab
1 changed files with 1 additions and 5 deletions

View File

@ -57,11 +57,7 @@ final private class Captcher(gameRepo: GameRepo)(implicit ec: scala.concurrent.E
challenges.find(_.gameId == id)
private def createFromDb: Fu[Option[Captcha]] =
findCheckmateInDb(10) flatMap {
_.fold(findCheckmateInDb(1))(g => fuccess(g.some))
} flatMap {
_ ?? fromGame
}
findCheckmateInDb(10) orElse findCheckmateInDb(1) flatMap { _ ?? fromGame }
private def findCheckmateInDb(distribution: Int): Fu[Option[Game]] =
gameRepo findRandomStandardCheckmate distribution