insert into seeds db before into games
This commit is contained in:
parent
87524addd6
commit
ab82ec00ed
1 changed files with 5 additions and 5 deletions
|
@ -81,18 +81,18 @@ def export_game(game_id) -> [bool, bool]:
|
||||||
|
|
||||||
with conn.cursor() as cur:
|
with conn.cursor() as cur:
|
||||||
# cur.execute("UPDATE seeds SET deck=(%s) WHERE seed=(%s);", (deck, seed))
|
# cur.execute("UPDATE seeds SET deck=(%s) WHERE seed=(%s);", (deck, seed))
|
||||||
cur.execute(
|
|
||||||
"INSERT INTO games (id, num_players, score, seed, variant_id, deck_plays, one_extra_card, one_less_card, all_or_nothing, actions)"
|
|
||||||
"VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
|
|
||||||
(game_id, num_players, game.score, seed, var_id, deck_plays, one_extra_card, one_less_card, all_or_nothing, compressed_actions))
|
|
||||||
cur.execute(
|
cur.execute(
|
||||||
"INSERT INTO seeds (seed, num_players, variant_id, deck)"
|
"INSERT INTO seeds (seed, num_players, variant_id, deck)"
|
||||||
"VALUES (%s, %s, %s, %s)"
|
"VALUES (%s, %s, %s, %s)"
|
||||||
"ON CONFLICT (seed) DO NOTHING",
|
"ON CONFLICT (seed) DO NOTHING",
|
||||||
(seed, num_players, var_id, compressed_deck)
|
(seed, num_players, var_id, compressed_deck)
|
||||||
)
|
)
|
||||||
|
cur.execute(
|
||||||
|
"INSERT INTO games (id, num_players, score, seed, variant_id, deck_plays, one_extra_card, one_less_card, all_or_nothing, actions)"
|
||||||
|
"VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
|
||||||
|
(game_id, num_players, game.score, seed, var_id, deck_plays, one_extra_card, one_less_card, all_or_nothing, compressed_actions))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
return True, not any([deck_plays, one_extra_card, one_less_card, all_or_nothing])
|
return True, not any([deck_plays, one_extra_card, one_less_card, all_or_nothing])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
export_game(960753)
|
export_game(961092)
|
||||||
|
|
Loading…
Reference in a new issue