diff --git a/src/app.py b/src/app.py index fd0c462..a845f79 100644 --- a/src/app.py +++ b/src/app.py @@ -38,6 +38,42 @@ "schedule": "Mondays, Wednesdays, Fridays, 2:00 PM - 3:00 PM", "max_participants": 30, "participants": ["john@mergington.edu", "olivia@mergington.edu"] + }, + "Soccer Team": { + "description": "Join the school soccer team and compete in matches", + "schedule": "Tuesdays and Thursdays, 4:00 PM - 5:30 PM", + "max_participants": 22, + "participants": ["liam@mergington.edu", "noah@mergington.edu"] + }, + "Basketball Team": { + "description": "Practice and play basketball with the school team", + "schedule": "Wednesdays and Fridays, 3:30 PM - 5:00 PM", + "max_participants": 15, + "participants": ["ava@mergington.edu", "mia@mergington.edu"] + }, + "Art Club": { + "description": "Explore various art techniques and create your own masterpieces", + "schedule": "Mondays, 3:30 PM - 5:00 PM", + "max_participants": 15, + "participants": ["amelia@mergington.edu", "harper@mergington.edu"] + }, + "Drama Club": { + "description": "Participate in plays and improve your acting skills", + "schedule": "Thursdays, 4:00 PM - 5:30 PM", + "max_participants": 20, + "participants": ["ella@mergington.edu", "scarlett@mergington.edu"] + }, + "Math Club": { + "description": "Solve challenging math problems and prepare for competitions", + "schedule": "Wednesdays, 3:30 PM - 4:30 PM", + "max_participants": 10, + "participants": ["james@mergington.edu", "benjamin@mergington.edu"] + }, + "Debate Team": { + "description": "Develop public speaking and argumentation skills", + "schedule": "Fridays, 4:00 PM - 5:30 PM", + "max_participants": 12, + "participants": ["charlotte@mergington.edu", "henry@mergington.edu"] } } @@ -59,9 +95,13 @@ def signup_for_activity(activity_name: str, email: str): if activity_name not in activities: raise HTTPException(status_code=404, detail="Activity not found") - # Get the specificy activity + # Get the activity activity = activities[activity_name] + # Validate student is not already signed up + if email in activity["participants"]: + raise HTTPException(status_code=400, detail="Student is already signed up") + # Add student activity["participants"].append(email) return {"message": f"Signed up {email} for {activity_name}"} diff --git a/src/static/app.js b/src/static/app.js index dcc1e38..df2b6e1 100644 --- a/src/static/app.js +++ b/src/static/app.js @@ -25,6 +25,10 @@ document.addEventListener("DOMContentLoaded", () => {
${details.description}
Schedule: ${details.schedule}
Availability: ${spotsLeft} spots left
+Participants:
+