phear
a000c9dd9a
- check for timeout in gamecreation.py - game deletion did not work correctly - game creation always wrote to the first game slot.
21 lines
488 B
Python
21 lines
488 B
Python
import helper,database
|
|
|
|
|
|
|
|
def main(gamename):
|
|
"""
|
|
|
|
manage the removal of game from game slots of players and
|
|
delete game from database.
|
|
TODO: add option do undo deletion when a failure happens
|
|
"""
|
|
#get player names from game table in database
|
|
mygame=database.GobanTable.get(gamename)
|
|
players = mygame.players()
|
|
#free game slots of players
|
|
for player in players:
|
|
myuser = database.Users.byUsername(player)
|
|
myuser.remove_game(gamename)
|
|
|
|
#delete table
|
|
mygame.destroySelf()
|