Change 'id' field to 'game_id'

This commit is contained in:
Thomas Rubini 2022-11-29 13:31:38 +01:00
parent 516cf831a6
commit 291674eab1
No known key found for this signature in database
GPG Key ID: C7D287C8C1CAC373
2 changed files with 5 additions and 5 deletions

View File

@ -5,7 +5,7 @@ from datetime import datetime, timedelta
import truthseeker
# Map of all actively running games
# games_list["game.id"]-> game info linked to that id
# games_list["game.game_id"]-> game info linked to that id
games_list = {}
def random_string(length: int) ->str:
@ -42,7 +42,7 @@ class Game:
"""
The game info class stores all information linked to a active game
Game.id : str, the game identifier of the game
Game.game_id : str, the game identifier of the game
Game.owner : Member, the game identifier of the game
Game.members : Member[], the members of the game
"""
@ -88,9 +88,9 @@ def create_game():
: return type : Game
"""
game = Game()
game.id = random_string(6)
game.game_id = random_string(6)
game.start_token = random_string(64)
games_list[game.id] = game
games_list[game.game_id] = game
#TODO ADD A WEBSOCKET IF THE GAME IS KNOWN TO BE MULTIPLAYER
return game

View File

@ -14,7 +14,7 @@ def create_game():
response = {}
response["status"] = "ok"
game = game_functions.create_game()
response["game_id"] = game.id
response["game_id"] = game.game_id
owner, owner_jwt = game.set_owner(username=username)
response["jwt"] = owner_jwt
return response