meerdere updates
This commit is contained in:
@@ -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"]
|
||||
Reference in New Issue
Block a user