remove unused tournament endpoints

team-info-lookup
Thibault Duplessis 2019-08-20 10:11:51 +02:00
parent 60defbabbb
commit 8b9043107b
4 changed files with 0 additions and 41 deletions

View File

@ -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 =>
JsonOk {
env.api.playerInfo(id, userId) flatMap {

View File

@ -9,19 +9,6 @@ import controllers.routes
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) =
views.html.base.layout(
title = trans.tournamentNotFound.txt()

View File

@ -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)
POST /tournament/$id<\w{8}>/join controllers.Tournament.join(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)
POST /tournament/$id<\w{8}>/terminate controllers.Tournament.terminate(id: String)
GET /tournament/help controllers.Tournament.help(system: Option[String] ?= None)

View File

@ -64,11 +64,6 @@ object PairingRepo {
_.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 removeByTourAndUserId(tourId: Tournament.ID, userId: User.ID) =