diff options
Diffstat (limited to 'add_participant.py')
| -rw-r--r-- | add_participant.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/add_participant.py b/add_participant.py index 948b4c6..7431b3b 100644 --- a/add_participant.py +++ b/add_participant.py @@ -13,19 +13,24 @@ con = sqlite3.connect(db_path) cur = con.cursor() - def add_participant(meeting_id, part_name, data): select = cur.execute( "SELECT participants FROM meeting WHERE meeting_id = ?;", (meeting_id,) ) participants = select.fetchone()[0] - print(participants) - if part_name in participants.split(","): + if participants is not None and part_name in participants.split(","): print("Participant name already taken!") else: cur.execute( "UPDATE meeting SET participants = ? WHERE meeting_id = ?;", - (participants + "," + part_name, meeting_id), + ( + ( + participants + "," + part_name + if participants is not None + else part_name + ), + meeting_id, + ), ) for datum in data: if datum[1]: @@ -34,7 +39,9 @@ def add_participant(meeting_id, part_name, data): (datum[0],), ) result = select.fetchone() - new_confirming = result[0] + "," + part_name + new_confirming = ( + result[0] + "," + part_name if result[0] is not None else part_name + ) cur.execute( f"UPDATE meeting_dates_{meeting_id} SET confirming = ? WHERE date = ?;", ( @@ -48,7 +55,9 @@ def add_participant(meeting_id, part_name, data): (datum[0],), ) result = select.fetchone() - new_declining = result[0] + "," + part_name + new_declining = ( + result[0] + "," + part_name if result[0] is not None else part_name + ) cur.execute( f"UPDATE meeting_dates_{meeting_id} SET declining = ? WHERE date = ?;", ( |
