diff --git a/src/app.py b/src/app.py index 4ebb1d9..2e2754b 100644 --- a/src/app.py +++ b/src/app.py @@ -38,6 +38,45 @@ "schedule": "Mondays, Wednesdays, Fridays, 2:00 PM - 3:00 PM", "max_participants": 30, "participants": ["john@mergington.edu", "olivia@mergington.edu"] + }, + # Sports related activities + "Soccer Team": { + "description": "Join the school soccer team and compete in local leagues", + "schedule": "Wednesdays and Fridays, 4:00 PM - 5:30 PM", + "max_participants": 18, + "participants": ["lucas@mergington.edu", "mia@mergington.edu"] + }, + "Basketball Club": { + "description": "Practice basketball skills and play friendly matches", + "schedule": "Tuesdays, 5:00 PM - 6:30 PM", + "max_participants": 15, + "participants": ["liam@mergington.edu", "ava@mergington.edu"] + }, + # Artistic activities + "Art Club": { + "description": "Explore painting, drawing, and other visual arts", + "schedule": "Thursdays, 3:30 PM - 5:00 PM", + "max_participants": 16, + "participants": ["grace@mergington.edu", "noah@mergington.edu"] + }, + "Drama Society": { + "description": "Participate in acting, stage production, and theater games", + "schedule": "Mondays, 4:00 PM - 5:30 PM", + "max_participants": 20, + "participants": ["ella@mergington.edu", "jack@mergington.edu"] + }, + # Intellectual activities + "Math Olympiad": { + "description": "Prepare for math competitions and solve challenging problems", + "schedule": "Wednesdays, 3:30 PM - 5:00 PM", + "max_participants": 10, + "participants": ["ethan@mergington.edu", "isabella@mergington.edu"] + }, + "Science Club": { + "description": "Conduct experiments and explore scientific concepts", + "schedule": "Fridays, 2:00 PM - 3:30 PM", + "max_participants": 14, + "participants": ["benjamin@mergington.edu", "charlotte@mergington.edu"] } } @@ -62,6 +101,9 @@ def signup_for_activity(activity_name: str, email: str): # Get the specific activity activity = activities[activity_name] + # Validate student is not already signed up + if email in activity["participants"]: + raise HTTPException(status_code=400, detail="Student 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..73acc26 100644 --- a/src/static/app.js +++ b/src/static/app.js @@ -20,11 +20,32 @@ document.addEventListener("DOMContentLoaded", () => { const spotsLeft = details.max_participants - details.participants.length; + // Build participants list HTML + let participantsHTML = ""; + if (details.participants.length > 0) { + participantsHTML = ` +
${details.description}
Schedule: ${details.schedule}
Availability: ${spotsLeft} spots left
+