remove pairings when a cheater is booted of an ongoing tournament
closes #1387
This commit is contained in:
parent
a40c0d3836
commit
47210cc181
|
@ -57,6 +57,9 @@ object PairingRepo {
|
|||
|
||||
def removeByTour(tourId: String) = coll.remove(selectTour(tourId)).void
|
||||
|
||||
def removeByTourAndUserId(tourId: String, userId: String) =
|
||||
coll.remove(selectTour(tourId) ++ selectUser(userId)).void
|
||||
|
||||
def count(tourId: String): Fu[Int] =
|
||||
coll.count(selectTour(tourId).some)
|
||||
|
||||
|
|
|
@ -225,6 +225,7 @@ private[tournament] final class TournamentApi(
|
|||
def ejectLame(tourId: String, userId: String) {
|
||||
Sequencing(tourId)(TournamentRepo.byId) { tour =>
|
||||
PlayerRepo.remove(tour.id, userId) >>
|
||||
(tour.isStarted ?? PairingRepo.removeByTourAndUserId(tour.id, userId)) >>
|
||||
updateNbPlayers(tour.id) >>-
|
||||
socketReload(tour.id) >>- publish()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue