def join_game(player_name: str, game_id): player_name = player_name.replace('"', "'") c.execute("INSERT INTO player (game, name) VALUES ('{}', \"{}\")".format( game_id, player_name)) conn.commit() return c.lastrowid
def new_round(rid, game): p = question.get_question_pair() c.execute("INSERT INTO round (game, round, regularStatement, falseStatement) VALUES ({}, {}, {}, {})".format( game, rid, p[0]["id"], p[1]["id"] )) conn.commit() return get_round_id(c.lastrowid)
def set_response(rid, player, text): text = text.replace('"', "'") c.execute( "INSERT INTO response (round, player, level) VALUES ({}, {}, {})". format(rid, player, text)) conn.commit()
def is_game_running(game_id): c.execute("SELECT COUNT(*) FROM game WHERE id={}".format(game_id)) return bool(c.fetchone()[0] > 0)
def delete_game(game_id): c.execute("DELETE FROM game WHERE id={}".format(game_id)) conn.commit()
def new_game(): c.execute("INSERT INTO game (code) VALUES ('{}')".format(get_game_code())) conn.commit() return c.lastrowid
def set_alien_status(pid, status): c.execute("UPDATE player SET alien={} WHERE id={}".format(status, pid)) conn.commit()
def delete_question(qid): c.execute("DELETE FROM statement WHERE id={}".format(qid)) conn.commit()
def edit_question(qid, text): text = text.replace('"', "'") c.execute("UPDATE statement SET text=\"{}\" WHERE id={}".format(text, qid)) conn.commit()
def add_question(text): text = text.replace('"', "'") c.execute("INSERT INTO statement (text) VALUES (\"{}\")".format(text)) conn.commit()