From 1a78ba5d07b63073ad2f3765f41611d4e4a09830 Mon Sep 17 00:00:00 2001 From: sofiar-msft Date: Mon, 23 Jun 2025 18:59:55 +0000 Subject: [PATCH 1/3] =?UTF-8?q?A=C3=B1adir=20actividades=20extracurricular?= =?UTF-8?q?es=20y=20validaci=C3=B3n=20de=20inscripci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/app.py b/src/app.py index 4ebb1d9..3a5c9a3 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 activities + "Soccer Team": { + "description": "Join the school soccer team and compete in local leagues", + "schedule": "Tuesdays and Thursdays, 4:00 PM - 5:30 PM", + "max_participants": 22, + "participants": ["lucas@mergington.edu", "mia@mergington.edu"] + }, + "Basketball Club": { + "description": "Practice basketball skills and play friendly matches", + "schedule": "Wednesdays, 3:30 PM - 5:00 PM", + "max_participants": 15, + "participants": ["liam@mergington.edu", "ava@mergington.edu"] + }, + # Artistic activities + "Art Club": { + "description": "Explore painting, drawing, and other visual arts", + "schedule": "Mondays, 3:30 PM - 5:00 PM", + "max_participants": 18, + "participants": ["isabella@mergington.edu", "noah@mergington.edu"] + }, + "Drama Society": { + "description": "Participate in acting, stage production, and school plays", + "schedule": "Thursdays, 4:00 PM - 5:30 PM", + "max_participants": 25, + "participants": ["amelia@mergington.edu", "jack@mergington.edu"] + }, + # Intellectual activities + "Math Olympiad": { + "description": "Prepare for math competitions and solve challenging problems", + "schedule": "Fridays, 2:00 PM - 3:30 PM", + "max_participants": 16, + "participants": ["ethan@mergington.edu", "charlotte@mergington.edu"] + }, + "Debate Club": { + "description": "Develop public speaking and argumentation skills", + "schedule": "Wednesdays, 4:00 PM - 5:30 PM", + "max_participants": 20, + "participants": ["benjamin@mergington.edu", "harper@mergington.edu"] } } @@ -62,6 +101,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") + # Add student activity["participants"].append(email) return {"message": f"Signed up {email} for {activity_name}"} From e1e87cced456abead56fa56aad926cac1d95fda7 Mon Sep 17 00:00:00 2001 From: sofiar-msft Date: Mon, 23 Jun 2025 20:27:21 +0000 Subject: [PATCH 2/3] Enhance activity card rendering to display participants and improve styling for participant sections --- src/static/index.html | 30 ++++++++++++++++++++++++++++++ src/static/styles.css | 23 +++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/src/static/index.html b/src/static/index.html index 3074f6e..20e93f0 100644 --- a/src/static/index.html +++ b/src/static/index.html @@ -46,5 +46,35 @@

Sign Up for an Activity

+ diff --git a/src/static/styles.css b/src/static/styles.css index a533b32..f77323f 100644 --- a/src/static/styles.css +++ b/src/static/styles.css @@ -142,3 +142,26 @@ footer { padding: 20px; color: #666; } + +.participants-section { + margin-top: 10px; + padding: 10px; + background-color: #eef3fb; + border-radius: 4px; +} + +.participants-section strong { + color: #1a237e; +} + +.participants-list { + margin: 8px 0 0 18px; + padding-left: 0; + list-style-type: disc; +} + +.participants-list li { + margin-bottom: 4px; + font-size: 15px; + color: #333; +} From 2e678ef2feb300a128870c294568820ee4e92bb8 Mon Sep 17 00:00:00 2001 From: sofiar-msft Date: Mon, 23 Jun 2025 20:32:38 +0000 Subject: [PATCH 3/3] Move the script from html file into js file --- src/static/app.js | 12 ++++++++++-- src/static/index.html | 30 ------------------------------ 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/src/static/app.js b/src/static/app.js index dcc1e38..17e840f 100644 --- a/src/static/app.js +++ b/src/static/app.js @@ -22,9 +22,17 @@ document.addEventListener("DOMContentLoaded", () => { activityCard.innerHTML = `

${name}

-

${details.description}

+

Description: ${details.description}

Schedule: ${details.schedule}

-

Availability: ${spotsLeft} spots left

+

Max Participants: ${details.max_participants}

+
+ Participants: +
    + ${details.participants && details.participants.length > 0 + ? details.participants.map(p => `
  • ${p}
  • `).join('') + : '
  • No participants yet
  • '} +
+
`; activitiesList.appendChild(activityCard); diff --git a/src/static/index.html b/src/static/index.html index 20e93f0..3074f6e 100644 --- a/src/static/index.html +++ b/src/static/index.html @@ -46,35 +46,5 @@

Sign Up for an Activity

-