remove old simul detection

This commit is contained in:
Thibault Duplessis 2015-04-04 12:42:14 +02:00
parent ac79279acf
commit a487d8d6b7
3 changed files with 7 additions and 12 deletions

View file

@ -65,7 +65,7 @@ object Round extends LilaController with TheftPrevention {
Env.game.crosstableApi(pov.game) zip
(!pov.game.isTournament ?? otherPovs(pov.gameId)) flatMap {
case (((tour, simul), crosstable), playing) =>
Env.api.roundApi.player(pov, lila.api.Mobile.Api.currentVersion, playing) map { data =>
Env.api.roundApi.player(pov, lila.api.Mobile.Api.currentVersion) map { data =>
Ok(html.round.player(pov, data, tour = tour, simul = simul, cross = crosstable, playing = playing))
}
}
@ -77,7 +77,7 @@ object Round extends LilaController with TheftPrevention {
if (isTheft(pov)) fuccess(theftResponse)
else {
if (pov.game.playableByAi) env.roundMap ! Tell(pov.game.id, AiPlay)
Env.api.roundApi.player(pov, apiVersion, Nil) map { Ok(_) }
Env.api.roundApi.player(pov, apiVersion) map { Ok(_) }
}
}
)

View file

@ -152,7 +152,7 @@ object Setup extends LilaController with TheftPrevention with play.api.http.Cont
implicit val req = ctx.req
redirectPov(p, routes.Round.player(p.fullId))
},
api = apiVersion => Env.api.roundApi.player(p, apiVersion, otherPovs = Nil) map { data =>
api = apiVersion => Env.api.roundApi.player(p, apiVersion) map { data =>
Created(data) as JSON
})
}
@ -164,7 +164,7 @@ object Setup extends LilaController with TheftPrevention with play.api.http.Cont
OptionFuResult(GameRepo pov fullId) { pov =>
pov.game.started.fold(
Redirect(routes.Round.player(pov.fullId)).fuccess,
Env.api.roundApi.player(pov, lila.api.Mobile.Api.currentVersion, otherPovs = Nil) zip
Env.api.roundApi.player(pov, lila.api.Mobile.Api.currentVersion) zip
(userId ?? UserRepo.named) flatMap {
case (data, user) => PreventTheft(pov) {
Ok(html.setup.await(
@ -211,7 +211,7 @@ object Setup extends LilaController with TheftPrevention with play.api.http.Cont
config => op(config)(ctx) flatMap {
case (pov, call) => negotiate(
html = fuccess(redirectPov(pov, call)),
api = apiVersion => Env.api.roundApi.player(pov, apiVersion, otherPovs = Nil) map { data =>
api = apiVersion => Env.api.roundApi.player(pov, apiVersion) map { data =>
Created(data) as JSON
}
)

View file

@ -21,7 +21,7 @@ private[api] final class RoundApi(
getSimul: Simul.ID => Fu[Option[Simul]],
lightUser: String => Option[LightUser]) {
def player(pov: Pov, apiVersion: Int, otherPovs: List[Pov])(implicit ctx: Context): Fu[JsObject] =
def player(pov: Pov, apiVersion: Int)(implicit ctx: Context): Fu[JsObject] =
jsonView.playerJson(pov, ctx.pref, apiVersion, ctx.me,
withBlurs = ctx.me ?? Granter(_.ViewBlurs)) zip
(pov.game.tournamentId ?? TournamentRepo.byId) zip
@ -31,8 +31,7 @@ private[api] final class RoundApi(
blindMode _ compose
withTournament(pov, tourOption)_ compose
withSimul(pov, simulOption)_ compose
withNote(note)_ compose
withOtherPovs(otherPovs)_
withNote(note)_
)(json)
}
@ -56,10 +55,6 @@ private[api] final class RoundApi(
)(json)
}
private def withOtherPovs(otherPovs: List[Pov])(json: JsObject) =
if (otherPovs.exists(_.game.nonAi)) json + ("simul" -> JsBoolean(true))
else json
private def withNote(note: String)(json: JsObject) =
if (note.isEmpty) json else json + ("note" -> JsString(note))