Ejemplo n.º 1
0
def new_round(rid, game):
    p = question.get_question_pair()
    c.execute(
        "INSERT INTO round (game, round, regularQuestion, falseQuestion) VALUES ({}, {}, {}, {})"
        .format(game, rid, p[0]["id"], p[1]["id"]))
    conn.commit()
    return get_round_id(c.lastrowid)
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
def add_category(text):
    text = text.replace('"', "'")

    c.execute("INSERT INTO category (text) VALUES ('{}')".format(text))
    conn.commit()
Ejemplo n.º 4
0
def delete_game(game_id):
    c.execute("DELETE FROM game WHERE id={}".format(game_id))
    conn.commit()
Ejemplo n.º 5
0
def remove_code(game_id):
    d.execute("UPDATE game SET code=NULL WHERE id={}".format(game_id))
    conn.commit()
Ejemplo n.º 6
0
def new_game():
    c.execute("INSERT INTO game (code) VALUES ('{}')".format(get_game_code()))
    conn.commit()
    return c.lastrowid
Ejemplo n.º 7
0
def delete_question(qid):
    c.execute("DELETE FROM prompt WHERE id={}".format(qid))
    conn.commit()
Ejemplo n.º 8
0
def edit_question(qid, cat, text):
    text = text.replace('"', "'")

    c.execute("UPDATE prompt SET category={}, text=\"{}\" WHERE id={}".format(
        cat, text, qid))
    conn.commit()
Ejemplo n.º 9
0
def add_question(cid, text):
    text = text.replace('"', "'")
    c.execute("INSERT INTO prompt (category, text) VALUES ({}, \"{}\")".format(
        cid, text))
    conn.commit()
Ejemplo n.º 10
0
def set_alien_status(pid, status):
    c.execute("UPDATE player SET alien={} WHERE id={}".format(status, pid))
    conn.commit()
Ejemplo n.º 11
0
def set_response(rid, player, text):
    text = text.replace('"', "'")
    c.execute(
        "INSERT INTO response (round, player, response) VALUES ({}, {}, \"{}\")"
        .format(rid, player, text))
    conn.commit()