Skip to content

Commit 600296f

Browse files
authored
Merge pull request #2 from Monal-Reddy/accelerate-with-copilot
Add registration validation and more activities
2 parents 57c84a6 + 02b4abd commit 600296f

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

src/app.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,45 @@
3838
"schedule": "Mondays, Wednesdays, Fridays, 2:00 PM - 3:00 PM",
3939
"max_participants": 30,
4040
"participants": ["john@mergington.edu", "olivia@mergington.edu"]
41+
},
42+
# Sports related activities
43+
"Soccer Team": {
44+
"description": "Join the school soccer team and compete in local leagues",
45+
"schedule": "Tuesdays and Thursdays, 4:00 PM - 5:30 PM",
46+
"max_participants": 18,
47+
"participants": ["lucas@mergington.edu", "mia@mergington.edu"]
48+
},
49+
"Basketball Club": {
50+
"description": "Practice basketball skills and play friendly matches",
51+
"schedule": "Wednesdays, 3:30 PM - 5:00 PM",
52+
"max_participants": 15,
53+
"participants": ["liam@mergington.edu", "ava@mergington.edu"]
54+
},
55+
# Artistic activities
56+
"Art Club": {
57+
"description": "Explore painting, drawing, and other visual arts",
58+
"schedule": "Mondays, 3:30 PM - 5:00 PM",
59+
"max_participants": 16,
60+
"participants": ["ella@mergington.edu", "noah@mergington.edu"]
61+
},
62+
"Drama Society": {
63+
"description": "Participate in theater productions and acting workshops",
64+
"schedule": "Fridays, 4:00 PM - 6:00 PM",
65+
"max_participants": 20,
66+
"participants": ["amelia@mergington.edu", "jack@mergington.edu"]
67+
},
68+
# Intellectual activities
69+
"Math Olympiad": {
70+
"description": "Prepare for math competitions and solve challenging problems",
71+
"schedule": "Thursdays, 3:30 PM - 5:00 PM",
72+
"max_participants": 14,
73+
"participants": ["charlotte@mergington.edu", "benjamin@mergington.edu"]
74+
},
75+
"Debate Club": {
76+
"description": "Develop public speaking and argumentation skills",
77+
"schedule": "Wednesdays, 4:00 PM - 5:30 PM",
78+
"max_participants": 12,
79+
"participants": ["henry@mergington.edu", "grace@mergington.edu"]
4180
}
4281
}
4382

@@ -61,7 +100,9 @@ def signup_for_activity(activity_name: str, email: str):
61100

62101
# Get the specific activity
63102
activity = activities[activity_name]
103+
# Validate student is not already signed up
64104

105+
if email in activity["participants"]:
65106
# Add student
66107
activity["participants"].append(email)
67108
return {"message": f"Signed up {email} for {activity_name}"}

src/static/app.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,32 @@ document.addEventListener("DOMContentLoaded", () => {
2020

2121
const spotsLeft = details.max_participants - details.participants.length;
2222

23+
// Build participants list HTML
24+
let participantsHTML = "";
25+
if (details.participants && details.participants.length > 0) {
26+
participantsHTML = `
27+
<div class="participants-section">
28+
<strong>Participants:</strong>
29+
<ul class="participants-list">
30+
${details.participants.map(email => `<li>${email}</li>`).join("")}
31+
</ul>
32+
</div>
33+
`;
34+
} else {
35+
participantsHTML = `
36+
<div class="participants-section">
37+
<strong>Participants:</strong>
38+
<span class="no-participants">No participants yet</span>
39+
</div>
40+
`;
41+
}
42+
2343
activityCard.innerHTML = `
2444
<h4>${name}</h4>
2545
<p>${details.description}</p>
2646
<p><strong>Schedule:</strong> ${details.schedule}</p>
2747
<p><strong>Availability:</strong> ${spotsLeft} spots left</p>
48+
${participantsHTML}
2849
`;
2950

3051
activitiesList.appendChild(activityCard);

src/static/styles.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,31 @@ footer {
142142
padding: 20px;
143143
color: #666;
144144
}
145+
146+
.participants-section {
147+
margin-top: 12px;
148+
padding: 10px;
149+
background-color: #eef3fb;
150+
border-radius: 4px;
151+
border: 1px solid #c5cae9;
152+
}
153+
154+
.participants-section strong {
155+
color: #3949ab;
156+
display: block;
157+
margin-bottom: 6px;
158+
}
159+
160+
.participants-list {
161+
list-style-type: disc;
162+
margin-left: 20px;
163+
margin-bottom: 0;
164+
color: #333;
165+
font-size: 15px;
166+
}
167+
168+
.no-participants {
169+
color: #888;
170+
font-style: italic;
171+
margin-left: 4px;
172+
}

0 commit comments

Comments
 (0)