save game rematch id

This commit is contained in:
Thibault Duplessis 2012-06-01 01:23:13 +02:00
parent 04c1bd6d82
commit 8e56db2512
2 changed files with 5 additions and 0 deletions

View file

@ -117,6 +117,10 @@ class GameRepo(collection: MongoCollection)
)
}
def saveNext(game: DbGame, nextId: String): IO[Unit] = io {
update(idSelector(game), $set("next" -> nextId))
}
def initialFen(gameId: String): IO[Option[String]] = io {
primitiveProjection[String](idSelector(gameId), "initialFen")
}

View file

@ -44,6 +44,7 @@ final class Rematcher(
_ gameRepo insert nextGame
nextId = nextGame.id
_ gameRepo denormalizeStarted nextGame
_ gameRepo.saveNext(pov.game, nextGame.id)
_ timelinePush(nextGame)
// messenges are not sent to the next game socket
// as nobody is there to see them yet