From 5c93ab7866c2fb033b147b03651956c8ba54628b Mon Sep 17 00:00:00 2001 From: DoHoon Ryu Date: Wed, 6 Aug 2025 07:40:43 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=ED=99=9C=EB=8F=99=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=EB=B2=A0=EC=9D=B4=EC=8A=A4=EC=97=90=20=EC=8A=A4?= =?UTF-8?q?=ED=8F=AC=EC=B8=A0,=20=EC=98=88=EC=88=A0=20=EB=B0=8F=20?= =?UTF-8?q?=EC=A7=80=EC=A0=81=20=ED=99=9C=EB=8F=99=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EB=B0=8F=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20=EC=A4=91=EB=B3=B5=20?= =?UTF-8?q?=EA=B0=80=EC=9E=85=20=EA=B2=80=EC=A6=9D=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= 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..3553f4c 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 matches", + "schedule": "Wednesdays, 4:00 PM - 5:30 PM", + "max_participants": 22, + "participants": ["alex@mergington.edu", "lucas@mergington.edu"] + }, + "Basketball Club": { + "description": "Practice basketball skills and play friendly games", + "schedule": "Mondays, 3:30 PM - 5:00 PM", + "max_participants": 15, + "participants": ["mia@mergington.edu", "noah@mergington.edu"] + }, + # Artistic activities + "Art Workshop": { + "description": "Explore painting, drawing, and sculpture techniques", + "schedule": "Thursdays, 4:00 PM - 5:30 PM", + "max_participants": 18, + "participants": ["ava@mergington.edu", "liam@mergington.edu"] + }, + "Drama Club": { + "description": "Act, direct, and produce school plays and performances", + "schedule": "Tuesdays, 3:30 PM - 5:00 PM", + "max_participants": 20, + "participants": ["ella@mergington.edu", "jack@mergington.edu"] + }, + # Intellectual activities + "Debate Team": { + "description": "Develop public speaking and argumentation skills", + "schedule": "Fridays, 4:00 PM - 5:30 PM", + "max_participants": 16, + "participants": ["chloe@mergington.edu", "ethan@mergington.edu"] + }, + "Math Club": { + "description": "Solve challenging math problems and prepare for competitions", + "schedule": "Wednesdays, 3:30 PM - 4:30 PM", + "max_participants": 14, + "participants": ["zoe@mergington.edu", "ben@mergington.edu"] } } @@ -62,6 +101,10 @@ def signup_for_activity(activity_name: str, email: str): # Get the specific activity activity = activities[activity_name] + # Validate email is not already signed up + if email in activity["participants"]: + raise HTTPException(status_code=400, detail="Email already signed up for this activity") + # Add student activity["participants"].append(email) return {"message": f"Signed up {email} for {activity_name}"} From 2c47cec7c265df92be17071674e15eaeab60dea0 Mon Sep 17 00:00:00 2001 From: DoHoon Ryu Date: Thu, 7 Aug 2025 05:30:24 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=ED=99=9C=EB=8F=99=20=EC=B9=B4=EB=93=9C?= =?UTF-8?q?=EC=97=90=20=EC=B0=B8=EA=B0=80=EC=9E=90=20=EB=AA=A9=EB=A1=9D=20?= =?UTF-8?q?=EB=B0=8F=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/static/app.js | 8 ++++++++ src/static/styles.css | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/src/static/app.js b/src/static/app.js index dcc1e38..d6e5ae0 100644 --- a/src/static/app.js +++ b/src/static/app.js @@ -20,11 +20,19 @@ document.addEventListener("DOMContentLoaded", () => { const spotsLeft = details.max_participants - details.participants.length; + const participantsList = details.participants.length > 0 + ? `` + : `

No participants yet

`; + activityCard.innerHTML = `

${name}

${details.description}

Schedule: ${details.schedule}

Availability: ${spotsLeft} spots left

+
+
Participants:
+ ${participantsList} +
`; activitiesList.appendChild(activityCard); diff --git a/src/static/styles.css b/src/static/styles.css index a533b32..b336215 100644 --- a/src/static/styles.css +++ b/src/static/styles.css @@ -74,6 +74,47 @@ section h3 { margin-bottom: 8px; } +.participants-section { + margin-top: 15px; + padding-top: 10px; + border-top: 1px solid #e0e0e0; +} + +.participants-section h5 { + margin-bottom: 8px; + color: #1a237e; + font-size: 14px; + font-weight: bold; +} + +.participants-list { + list-style: none; + padding: 0; + margin: 0; +} + +.participants-list li { + padding: 3px 0; + padding-left: 15px; + position: relative; + font-size: 14px; + color: #555; +} + +.participants-list li:before { + content: "•"; + color: #1a237e; + font-weight: bold; + position: absolute; + left: 0; +} + +.no-participants { + font-style: italic; + color: #888; + font-size: 14px; +} + .form-group { margin-bottom: 15px; } From 6073cb96f4c138bd978bee2d7f7f5447fc74a71a Mon Sep 17 00:00:00 2001 From: DoHoon Ryu Date: Thu, 7 Aug 2025 14:45:03 +0900 Subject: [PATCH 3/3] Update src/static/app.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/static/app.js | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/static/app.js b/src/static/app.js index d6e5ae0..f1aa73c 100644 --- a/src/static/app.js +++ b/src/static/app.js @@ -20,21 +20,35 @@ document.addEventListener("DOMContentLoaded", () => { const spotsLeft = details.max_participants - details.participants.length; - const participantsList = details.participants.length > 0 - ? `
    ${details.participants.map(email => `
  • ${email}
  • `).join('')}
` - : `

No participants yet

`; + // Create participants section safely + let participantsSection = document.createElement("div"); + participantsSection.className = "participants-section"; + const participantsHeader = document.createElement("h5"); + participantsHeader.textContent = "Participants:"; + participantsSection.appendChild(participantsHeader); + if (details.participants.length > 0) { + const ul = document.createElement("ul"); + ul.className = "participants-list"; + details.participants.forEach(email => { + const li = document.createElement("li"); + li.textContent = email; + ul.appendChild(li); + }); + participantsSection.appendChild(ul); + } else { + const p = document.createElement("p"); + p.className = "no-participants"; + p.textContent = "No participants yet"; + participantsSection.appendChild(p); + } activityCard.innerHTML = `

${name}

${details.description}

Schedule: ${details.schedule}

Availability: ${spotsLeft} spots left

-
-
Participants:
- ${participantsList} -
`; - + activityCard.appendChild(participantsSection); activitiesList.appendChild(activityCard); // Add option to select dropdown