From 51013bc56c0883401dadfbbac0d500cf2d5d6fda Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Tue, 26 Feb 2013 13:47:31 +0100 Subject: [PATCH] don't store move times for imported games --- app/game/DbGame.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/game/DbGame.scala b/app/game/DbGame.scala index df3822c714..8de4883425 100644 --- a/app/game/DbGame.scala +++ b/app/game/DbGame.scala @@ -130,7 +130,7 @@ case class DbGame( def copyPlayer(player: DbPlayer) = player.copy( ps = player encodePieces game.allPieces, blurs = player.blurs + (blur && move.color == player.color).fold(1, 0), - moveTimes = (move.color == player.color).fold( + moveTimes = ((!isPgnImport) && (move.color == player.color)).fold( lastMoveTime.fold( lmt ⇒ (nowSeconds - lmt) |> { mt ⇒ val encoded = MoveTime encode mt @@ -364,6 +364,8 @@ case class DbGame( def pgnImport = metadata flatMap(_.pgnImport) + def isPgnImport = pgnImport.isDefined + private def playerMaps[A](f: DbPlayer ⇒ Option[A]): List[A] = players.map(f).flatten } @@ -437,7 +439,7 @@ case class RawDbGame( whitePlayer ← p.headOption map (_ decode Color.White) blackPlayer ← p lift 1 map (_ decode Color.Black) trueStatus ← Status(s) - metadata <- me map (_.decode) + metadata = me map (_.decode) } yield DbGame( id = id, token = tk | DbGame.defaultToken,