Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 compete in basketball tournaments",
"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": "Thursdays, 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": "Mondays and Wednesdays, 4:00 PM - 5:30 PM",
"max_participants": 20,
"participants": ["elijah@mergington.edu", "isabella@mergington.edu"]
},
"Math Club": {
"description": "Solve challenging math problems and prepare for competitions",
"schedule": "Tuesdays, 3:30 PM - 4:30 PM",
"max_participants": 10,
"participants": ["james@mergington.edu", "charlotte@mergington.edu"]
},
"Debate Team": {
"description": "Develop public speaking and argumentation skills",
"schedule": "Fridays, 4:00 PM - 5:30 PM",
"max_participants": 12,
"participants": ["benjamin@mergington.edu", "evelyn@mergington.edu"]
}
}

Expand All @@ -62,6 +98,10 @@ def signup_for_activity(activity_name: str, email: str):
# Get the specificy activity
activity = activities[activity_name]

# Validate student is not already signed up
if email in activity["participants"]:
return {"message": f"{email} is already signed up for {activity_name}"}

# Add student
activity["participants"].append(email)
return {"message": f"Signed up {email} for {activity_name}"}
5 changes: 5 additions & 0 deletions src/static/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ document.addEventListener("DOMContentLoaded", () => {
<p>${details.description}</p>
<p><strong>Schedule:</strong> ${details.schedule}</p>
<p><strong>Availability:</strong> ${spotsLeft} spots left</p>
<p><strong>Participants:</strong> ${
details.participants.length > 0
? details.participants.map(participant => `<span class="participant">${participant}</span>`).join(" ")
: "None"
}</p>
`;

activitiesList.appendChild(activityCard);
Expand Down
10 changes: 10 additions & 0 deletions src/static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ section h3 {
margin-bottom: 8px;
}

.activity-card .participant {
background-color: #e8f5e9;
color: #2e7d32;
padding: 2px 5px;
border-radius: 3px;
display: inline-block;
margin-right: 5px;
margin-bottom: 5px;
}

.form-group {
margin-bottom: 15px;
}
Expand Down
Loading