21 lines
487 B
Python
21 lines
487 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.removegame(gamename)
|
|
|
|
#delete table
|
|
mygame.destroySelf()
|