meerdere updates

This commit is contained in:
ben
2026-08-03 17:45:56 +02:00
parent cff9aa0dd1
commit e4ae4bc9d5
6 changed files with 205 additions and 24 deletions
+39
View File
@@ -0,0 +1,39 @@
from database import execute, fetch_one
def respond_to_event(event_id, user_id, status):
query = """
INSERT INTO event_signups
(event_id, user_id, status)
VALUES (?, ?, ?)
ON CONFLICT(event_id, user_id)
DO UPDATE SET status = excluded.status
"""
return execute(
query,
(
event_id,
user_id,
status
)
)
def count_confirmations(event_id):
query = """
SELECT COUNT(*) as amount
FROM event_signups
WHERE event_id = ?
AND status = 'going'
"""
result = fetch_one(
query,
(event_id,)
)
return result["amount"]