don't abort tournament games anymore

This commit is contained in:
Thibault Duplessis 2014-05-01 16:04:20 +02:00
parent a2934d3a47
commit 30cd90b075
5 changed files with 4 additions and 16 deletions

View file

@ -8,10 +8,6 @@ import lila.hub.actorApi.map.Tell
private[round] final class Meddler(roundMap: ActorRef, socketHub: ActorRef) {
def forceAbort(gameId: String) {
roundMap ! Tell(gameId, AbortForce)
}
def resign(pov: Pov) {
roundMap ! Tell(pov.gameId, Resign(pov.playerId))
}

View file

@ -46,10 +46,6 @@ private[round] final class Round(
pov.game.abortable ?? finisher(pov.game, _.Aborted)
}
case AbortForce => handle { game =>
game.playable ?? finisher(game, _.Aborted)
}
case Resign(playerId) => handle(playerId) { pov =>
pov.game.resignable ?? finisher(pov.game, _.Resign, Some(!pov.color))
}

View file

@ -85,7 +85,6 @@ package round {
case class PlayResult(events: Events, fen: String, lastMove: Option[String])
case class Abort(playerId: String)
case object AbortForce
case class Resign(playerId: String)
case class ResignColor(color: Color)
case class ResignForce(playerId: String)

View file

@ -14,7 +14,7 @@ import lila.game.{ Game, GameRepo }
import lila.hub.actorApi.lobby.ReloadTournaments
import lila.hub.actorApi.map.Tell
import lila.hub.actorApi.router.Tourney
import lila.round.actorApi.round.{ AbortForce, ResignColor }
import lila.round.actorApi.round.ResignColor
import lila.socket.actorApi.SendToFlag
import lila.user.{ User, UserRepo }
import makeTimeout.short
@ -86,15 +86,13 @@ private[tournament] final class TournamentApi(
def finish(started: Started): Fu[Tournament] =
if (started.pairings.isEmpty) $remove(started) >>- reloadSiteSocket >>- lobbyReload inject started
else started.readyToFinish.fold({
val pairingsToAbort = started.playingPairings
val finished = started.finish
$update(finished) >>-
sendTo(started.id, ReloadPage) >>-
reloadSiteSocket >>-
(pairingsToAbort foreach { pairing =>
roundMap ! Tell(pairing.gameId, AbortForce)
}) >>
finished.players.filter(_.score > 0).map(p => UserRepo.incToints(p.id, p.score)).sequenceFu inject finished
finished.players.filter(_.score > 0).map { p =>
UserRepo.incToints(p.id, p.score)
}.sequenceFu inject finished
}, fuccess(started))
def join(tour: Enterable, me: User, password: Option[String]): Funit =

View file

@ -141,7 +141,6 @@
}
#tournament form.plain .error {
margin-left: 160px;
color: red;
}