Skip to content

Commit ec0214c

Browse files
Merge pull request #2 from JasperBoomBejo/accelerate-with-copilot
Add registration validation and more activities
2 parents 4540d81 + ee69697 commit ec0214c

File tree

3 files changed

+78
-1
lines changed

3 files changed

+78
-1
lines changed

src/app.py

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,42 @@
3838
"schedule": "Mondays, Wednesdays, Fridays, 2:00 PM - 3:00 PM",
3939
"max_participants": 30,
4040
"participants": ["[email protected]", "[email protected]"]
41+
},
42+
"Soccer Team": {
43+
"description": "Join the school soccer team and compete in matches",
44+
"schedule": "Tuesdays and Thursdays, 4:00 PM - 5:30 PM",
45+
"max_participants": 22,
46+
"participants": ["[email protected]", "[email protected]"]
47+
},
48+
"Basketball Team": {
49+
"description": "Practice and play basketball with the school team",
50+
"schedule": "Wednesdays and Fridays, 3:30 PM - 5:00 PM",
51+
"max_participants": 15,
52+
"participants": ["[email protected]", "[email protected]"]
53+
},
54+
"Art Club": {
55+
"description": "Explore your creativity through painting and drawing",
56+
"schedule": "Mondays, 3:30 PM - 5:00 PM",
57+
"max_participants": 15,
58+
"participants": ["[email protected]", "[email protected]"]
59+
},
60+
"Drama Club": {
61+
"description": "Participate in plays and improve your acting skills",
62+
"schedule": "Thursdays, 4:00 PM - 5:30 PM",
63+
"max_participants": 20,
64+
"participants": ["[email protected]", "[email protected]"]
65+
},
66+
"Math Club": {
67+
"description": "Solve challenging problems and prepare for math competitions",
68+
"schedule": "Wednesdays, 3:30 PM - 4:30 PM",
69+
"max_participants": 10,
70+
"participants": ["[email protected]", "[email protected]"]
71+
},
72+
"Science Club": {
73+
"description": "Conduct experiments and explore scientific concepts",
74+
"schedule": "Fridays, 4:00 PM - 5:00 PM",
75+
"max_participants": 12,
76+
"participants": ["[email protected]", "[email protected]"]
4177
}
4278
}
4379

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

101+
# Validate student is not already signed up
102+
if email in activity["participants"]:
103+
raise HTTPException(status_code=400, detail="Already signed up for this activity")
104+
65105
# Add student
66106
activity["participants"].append(email)
67-
return {"message": f"Signed up {email} for {activity_name}"}
107+
return {"message": f"Signed up {email} for {activity_name}"}

src/static/app.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ document.addEventListener("DOMContentLoaded", () => {
2525
<p>${details.description}</p>
2626
<p><strong>Schedule:</strong> ${details.schedule}</p>
2727
<p><strong>Availability:</strong> ${spotsLeft} spots left</p>
28+
<div>
29+
<strong>Participants:</strong>
30+
<ul>
31+
${details.participants.map(participant => `<li>${participant}</li>`).join("")}
32+
</ul>
33+
</div>
2834
`;
2935

3036
activitiesList.appendChild(activityCard);

src/static/styles.css

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ section h3 {
7474
margin-bottom: 8px;
7575
}
7676

77+
.activity-card ul {
78+
margin-top: 10px;
79+
padding-left: 20px;
80+
list-style-type: disc;
81+
color: #555;
82+
}
83+
84+
.activity-card ul li {
85+
margin-bottom: 5px;
86+
}
87+
7788
.form-group {
7889
margin-bottom: 15px;
7990
}
@@ -142,3 +153,23 @@ footer {
142153
padding: 20px;
143154
color: #666;
144155
}
156+
157+
.participant-info {
158+
margin-top: 15px;
159+
padding: 10px;
160+
border: 1px solid #ddd;
161+
border-radius: 5px;
162+
background-color: #f1f8e9;
163+
color: #33691e;
164+
font-size: 14px;
165+
}
166+
167+
.participant-info ul {
168+
margin-top: 10px;
169+
padding-left: 20px;
170+
list-style-type: circle;
171+
}
172+
173+
.participant-info ul li {
174+
margin-bottom: 5px;
175+
}

0 commit comments

Comments
 (0)