Fix error creating a table

This commit is contained in:
Christoph Hagen 2022-10-12 22:02:01 +02:00
parent 30abe56325
commit 454bd204b8
2 changed files with 3 additions and 4 deletions

View File

@ -43,7 +43,7 @@ final class TableManagement {
try await table.create(on: database)
player.$table.id = table.id
try await player.update(on: database)
let waitingTable = WaitingTable(newTable: table)
let waitingTable = WaitingTable(newTable: table, user: player)
self.tables[waitingTable.id] = waitingTable
return waitingTable.tableInfo(forPlayer: player.name)
}

View File

@ -23,10 +23,9 @@ final class WaitingTable: AbstractTable<WaitingPlayer> {
/**
Create a new table.
- Parameter name: The name of the table
- Parameter isPublic: The table is visible and joinable by everyone
- Parameter player: The user who created the table
*/
init(newTable object: Table) {
let user = object.players[0]
init(newTable object: Table, user: User) {
let player = WaitingPlayer(name: user.name, points: user.points)
player.isNextActor = true
super.init(id: object.id!, name: object.name, isPublic: object.isPublic, players: [player])