From 7ae6fd768fc4dbaf8df242221bce796cabb160be Mon Sep 17 00:00:00 2001 From: Erik Guzman Date: Thu, 27 Mar 2025 17:01:16 +0000 Subject: [PATCH 1/3] Add new activities and improve signup validation --- src/app.py | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) 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}"} From 7a21fe902dc2196f8af1f70a15bc529b930a7c5c Mon Sep 17 00:00:00 2001 From: Erik Guzman Date: Thu, 27 Mar 2025 17:13:07 +0000 Subject: [PATCH 2/3] Add participant list to activity cards and style updates --- src/static/app.js | 4 ++++ src/static/styles.css | 12 ++++++++++++ 2 files changed, 16 insertions(+) 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:

+ `; activitiesList.appendChild(activityCard); diff --git a/src/static/styles.css b/src/static/styles.css index a533b32..c3e30af 100644 --- a/src/static/styles.css +++ b/src/static/styles.css @@ -74,6 +74,18 @@ section h3 { margin-bottom: 8px; } +.activity-card ul { + margin-top: 10px; + padding-left: 20px; + list-style-type: disc; + color: #555; +} + +.activity-card ul li { + margin-bottom: 5px; + font-size: 14px; +} + .form-group { margin-bottom: 15px; } From ccb3b441143479b4d249f295a5de2d75556029de Mon Sep 17 00:00:00 2001 From: Erik Guzman Date: Thu, 27 Mar 2025 17:21:41 +0000 Subject: [PATCH 3/3] Fix CSS formatting by adding spacing to section headings --- src/static/styles.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/static/styles.css b/src/static/styles.css index c3e30af..127be34 100644 --- a/src/static/styles.css +++ b/src/static/styles.css @@ -79,6 +79,7 @@ section h3 { padding-left: 20px; list-style-type: disc; color: #555; + } .activity-card ul li {