remove unused tournament endpoints
parent
60defbabbb
commit
8b9043107b
|
@ -130,27 +130,6 @@ object Tournament extends LilaController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def userGameNbMini(id: String, user: String, nb: Int) = Open { implicit ctx =>
|
|
||||||
withUserGameNb(id, user, nb) { pov =>
|
|
||||||
Ok(html.tournament.bits.miniGame(pov))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def userGameNbShow(id: String, user: String, nb: Int) = Open { implicit ctx =>
|
|
||||||
withUserGameNb(id, user, nb) { pov =>
|
|
||||||
Redirect(routes.Round.watcher(pov.gameId, pov.color.name))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private def withUserGameNb(id: String, user: String, nb: Int)(withPov: Pov => Result)(implicit ctx: Context): Fu[Result] = {
|
|
||||||
val userId = lila.user.User normalize user
|
|
||||||
OptionFuResult(PairingRepo.byTourUserNb(id, userId, nb)) { pairing =>
|
|
||||||
GameRepo game pairing.id map {
|
|
||||||
_.flatMap { Pov.ofUserId(_, userId) }.fold(Redirect(routes.Tournament show id))(withPov)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def player(id: String, userId: String) = Open { implicit ctx =>
|
def player(id: String, userId: String) = Open { implicit ctx =>
|
||||||
JsonOk {
|
JsonOk {
|
||||||
env.api.playerInfo(id, userId) flatMap {
|
env.api.playerInfo(id, userId) flatMap {
|
||||||
|
|
|
@ -9,19 +9,6 @@ import controllers.routes
|
||||||
|
|
||||||
object bits {
|
object bits {
|
||||||
|
|
||||||
def miniGame(pov: lila.game.Pov)(implicit ctx: Context) = frag(
|
|
||||||
gameFen(pov),
|
|
||||||
div(cls := "vstext")(
|
|
||||||
playerUsername(pov.opponent, withRating = true, withTitle = true),
|
|
||||||
br,
|
|
||||||
span(cls := List(
|
|
||||||
"result" -> true,
|
|
||||||
"win" -> ~pov.win,
|
|
||||||
"loss" -> ~pov.loss
|
|
||||||
))(gameEndStatus(pov.game))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
def notFound()(implicit ctx: Context) =
|
def notFound()(implicit ctx: Context) =
|
||||||
views.html.base.layout(
|
views.html.base.layout(
|
||||||
title = trans.tournamentNotFound.txt()
|
title = trans.tournamentNotFound.txt()
|
||||||
|
|
|
@ -229,8 +229,6 @@ GET /tournament/$id<\w{8}>/page-of/:userId controllers.Tournament.pageOf(id:
|
||||||
GET /tournament/$id<\w{8}>/socket/v:apiVersion controllers.Tournament.websocket(id: String, apiVersion: Int)
|
GET /tournament/$id<\w{8}>/socket/v:apiVersion controllers.Tournament.websocket(id: String, apiVersion: Int)
|
||||||
POST /tournament/$id<\w{8}>/join controllers.Tournament.join(id: String)
|
POST /tournament/$id<\w{8}>/join controllers.Tournament.join(id: String)
|
||||||
POST /tournament/$id<\w{8}>/withdraw controllers.Tournament.pause(id: String)
|
POST /tournament/$id<\w{8}>/withdraw controllers.Tournament.pause(id: String)
|
||||||
GET /tournament/$id<\w{8}>/mini/:user/:nb controllers.Tournament.userGameNbMini(id: String, user: String, nb: Int)
|
|
||||||
GET /tournament/$id<\w{8}>/show/:user/:nb controllers.Tournament.userGameNbShow(id: String, user: String, nb: Int)
|
|
||||||
GET /tournament/$id<\w{8}>/player/:user controllers.Tournament.player(id: String, user: String)
|
GET /tournament/$id<\w{8}>/player/:user controllers.Tournament.player(id: String, user: String)
|
||||||
POST /tournament/$id<\w{8}>/terminate controllers.Tournament.terminate(id: String)
|
POST /tournament/$id<\w{8}>/terminate controllers.Tournament.terminate(id: String)
|
||||||
GET /tournament/help controllers.Tournament.help(system: Option[String] ?= None)
|
GET /tournament/help controllers.Tournament.help(system: Option[String] ?= None)
|
||||||
|
|
|
@ -64,11 +64,6 @@ object PairingRepo {
|
||||||
_.flatMap(_.getAs[Game.ID]("_id"))
|
_.flatMap(_.getAs[Game.ID]("_id"))
|
||||||
}
|
}
|
||||||
|
|
||||||
def byTourUserNb(tourId: Tournament.ID, userId: User.ID, nb: Int): Fu[Option[Pairing]] =
|
|
||||||
(nb > 0) ?? coll.find(
|
|
||||||
selectTourUser(tourId, userId)
|
|
||||||
).sort(chronoSort).skip(nb - 1).uno[Pairing]
|
|
||||||
|
|
||||||
def removeByTour(tourId: Tournament.ID) = coll.remove(selectTour(tourId)).void
|
def removeByTour(tourId: Tournament.ID) = coll.remove(selectTour(tourId)).void
|
||||||
|
|
||||||
def removeByTourAndUserId(tourId: Tournament.ID, userId: User.ID) =
|
def removeByTourAndUserId(tourId: Tournament.ID, userId: User.ID) =
|
||||||
|
|
Loading…
Reference in New Issue