Fix delete empty table

This commit is contained in:
Christoph Hagen 2021-12-23 12:52:28 +01:00
parent 176c5753d7
commit 1d1044c3f8

View File

@ -113,8 +113,9 @@ final class TableManagement {
player.$table.id = nil
guard let table = WaitingTable(oldTable: oldTable, removing: player.name) else {
tables[oldTable.id] = nil
return Table.query(on: database).filter(\.$id == oldTable.id).delete().flatMap {
player.update(on: database)
return player.update(on: database).flatMap {
print("Updating player")
return Table.query(on: database).filter(\.$id == oldTable.id).delete()
}
}
/// `player.canStartGame` is automatically set to false, because table is not full