Jon Solow
commited on
Commit
·
6a890b1
1
Parent(s):
56a9838
Change selection by deleting and inserting new row in user_rosters
Browse files- src/data_storage.py +5 -2
src/data_storage.py
CHANGED
@@ -24,12 +24,15 @@ def update_selection(user_id: str, position_id: str, player_id: str):
|
|
24 |
with get_db_connection() as con:
|
25 |
cur = con.cursor()
|
26 |
cur.execute(
|
27 |
-
f"""
|
|
|
|
|
|
|
|
|
28 |
VALUES({user_id}, '{position_id}', '{player_id}')
|
29 |
"""
|
30 |
)
|
31 |
|
32 |
-
|
33 |
def get_user_team(user_id):
|
34 |
with get_db_connection() as con:
|
35 |
cur = con.cursor()
|
|
|
24 |
with get_db_connection() as con:
|
25 |
cur = con.cursor()
|
26 |
cur.execute(
|
27 |
+
f"""DELETE FROM user_rosters where user_id = {user_id} and position_id = '{position_id}'
|
28 |
+
"""
|
29 |
+
)
|
30 |
+
cur.execute(
|
31 |
+
f"""INSERT INTO user_rosters (user_id, position_id, player_id )
|
32 |
VALUES({user_id}, '{position_id}', '{player_id}')
|
33 |
"""
|
34 |
)
|
35 |
|
|
|
36 |
def get_user_team(user_id):
|
37 |
with get_db_connection() as con:
|
38 |
cur = con.cursor()
|