summaryrefslogtreecommitdiff
path: root/add_participant.py
diff options
context:
space:
mode:
authorNiclas Dobbertin <niclas.dobbertin@mailbox.org>2026-07-10 11:51:09 +0200
committerNiclas Dobbertin <niclas.dobbertin@mailbox.org>2026-07-10 11:51:09 +0200
commit5aa8e0d2dafadabbe3796f63741868a9b0d17a5c (patch)
tree8f3177d3c2e8dbebd3b1ad04aa7b8fa6ff060c5c /add_participant.py
parentc6c842b93c616a690546c6dd0a029f578ecf5769 (diff)
move into subdirs
Diffstat (limited to 'add_participant.py')
-rw-r--r--add_participant.py87
1 files changed, 0 insertions, 87 deletions
diff --git a/add_participant.py b/add_participant.py
deleted file mode 100644
index 7431b3b..0000000
--- a/add_participant.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env python3
-
-import os
-import sqlite3
-
-db_path = "terminfinder_db.sqlite"
-
-if not os.path.exists(db_path):
- print(f"DB named {db_path} does not exist!")
- exit(1)
-
-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]
- 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
- if participants is not None
- else part_name
- ),
- meeting_id,
- ),
- )
- for datum in data:
- if datum[1]:
- select = cur.execute(
- f"SELECT confirming FROM meeting_dates_{meeting_id} WHERE date = ?;",
- (datum[0],),
- )
- result = select.fetchone()
- 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 = ?;",
- (
- new_confirming,
- datum[0],
- ),
- )
- else:
- select = cur.execute(
- f"SELECT declining FROM meeting_dates_{meeting_id} WHERE date = ?;",
- (datum[0],),
- )
- result = select.fetchone()
- 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 = ?;",
- (
- new_declining,
- datum[0],
- ),
- )
- con.commit()
-
-
-meeting_id = "meet1"
-part_name = "niklas"
-data = [
- ("2026-01-01_12-00", True),
- ("2026-01-01_13-00", False),
- ("2026-01-02_14-00", True),
-]
-add_participant(meeting_id, part_name, data)
-
-meeting_id = "meet1"
-part_name = "philip"
-data = [
- ("2026-01-01_12-00", False),
- ("2026-01-01_13-00", True),
- ("2026-01-02_14-00", True),
-]
-add_participant(meeting_id, part_name, data)