diff options
| author | Niclas Dobbertin <niclas.dobbertin@mailbox.org> | 2026-07-09 23:39:40 +0200 |
|---|---|---|
| committer | Niclas Dobbertin <niclas.dobbertin@mailbox.org> | 2026-07-09 23:39:40 +0200 |
| commit | e1563ab64aa56c725d91200c3975eab6442071c3 (patch) | |
| tree | 5b96e8172480707fabda96aecc85e9b242ea3052 /add_participant.py | |
| parent | dec672b22381b5f9fd3d51f8233cc69f12964fd2 (diff) | |
remove starting comma to prevent empty participant but counting
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 = ?;", ( |
