From 10918318d4b4999814180eec2a416fff6e44e6d4 Mon Sep 17 00:00:00 2001 From: BhargavaManit <104419723+Bhargava49@users.noreply.github.com> Date: Mon, 10 Nov 2025 12:18:09 +0000 Subject: [PATCH 1/2] feat: add new extracurricular activities and participant validation to signup function --- src/app.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/app.py b/src/app.py index 4ebb1d9..8393aa6 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": "Competitive soccer team training and matches", + "schedule": "Monday, Wednesday, Friday, 4:00 PM - 6:00 PM", + "max_participants": 22, + "participants": ["liam@mergington.edu", "noah@mergington.edu"] + }, + "Basketball Club": { + "description": "Pickup games, drills, and intramural tournaments", + "schedule": "Tuesdays and Thursdays, 5:00 PM - 7:00 PM", + "max_participants": 15, + "participants": ["ava@mergington.edu", "isabella@mergington.edu"] + }, + "Art Club": { + "description": "Explore drawing, painting, and mixed media projects", + "schedule": "Wednesdays, 3:30 PM - 5:00 PM", + "max_participants": 18, + "participants": ["mia@mergington.edu", "charlotte@mergington.edu"] + }, + "Drama Club": { + "description": "Acting workshops, rehearsals, and stage productions", + "schedule": "Thursdays, 4:00 PM - 6:30 PM", + "max_participants": 25, + "participants": ["amelia@mergington.edu", "harper@mergington.edu"] + }, + "Debate Team": { + "description": "Practice public speaking, research, and competitive debates", + "schedule": "Mondays and Thursdays, 4:00 PM - 5:30 PM", + "max_participants": 16, + "participants": ["elijah@mergington.edu", "lucas@mergington.edu"] + }, + "Math Club": { + "description": "Problem-solving sessions and preparation for math competitions", + "schedule": "Fridays, 3:30 PM - 4:30 PM", + "max_participants": 20, + "participants": ["oliver@mergington.edu", "jack@mergington.edu"] } } @@ -62,6 +98,10 @@ 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 for this activity") + # Add student activity["participants"].append(email) return {"message": f"Signed up {email} for {activity_name}"} From 40f8eb3a4acfdf5f4230bdedaa66d9d9d60b7888 Mon Sep 17 00:00:00 2001 From: BhargavaManit <104419723+Bhargava49@users.noreply.github.com> Date: Mon, 10 Nov 2025 13:25:13 +0000 Subject: [PATCH 2/2] Add FastAPI tests and improve UI feedback --- requirements.txt | 2 ++ src/static/app.js | 5 +++++ src/static/styles.css | 8 ++++++++ tests/test_app.py | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 tests/test_app.py diff --git a/requirements.txt b/requirements.txt index 97dc7cd..2522ad0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,4 @@ fastapi uvicorn +pytest +httpx diff --git a/src/static/app.js b/src/static/app.js index dcc1e38..d4bf631 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:
+