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+ "Soccer Team" : {
43+ "description" : "Practice soccer skills and compete in inter-school matches" ,
44+ "schedule" : "Mondays and Wednesdays, 4:00 PM - 5:30 PM" ,
45+ "max_participants" : 22 ,
46+ "participants" : ["liam@mergington.edu" , "noah@mergington.edu" ]
47+ },
48+ "Basketball Club" : {
49+ "description" : "Develop teamwork and basketball fundamentals" ,
50+ "schedule" : "Tuesdays and Fridays, 4:00 PM - 5:30 PM" ,
51+ "max_participants" : 15 ,
52+ "participants" : ["ava@mergington.edu" , "isabella@mergington.edu" ]
53+ },
54+ "Drama Club" : {
55+ "description" : "Explore acting, stage presence, and theater production" ,
56+ "schedule" : "Thursdays, 3:30 PM - 5:00 PM" ,
57+ "max_participants" : 18 ,
58+ "participants" : ["mia@mergington.edu" , "charlotte@mergington.edu" ]
59+ },
60+ "Painting Workshop" : {
61+ "description" : "Learn painting techniques and create visual art projects" ,
62+ "schedule" : "Wednesdays, 3:30 PM - 5:00 PM" ,
63+ "max_participants" : 16 ,
64+ "participants" : ["amelia@mergington.edu" , "harper@mergington.edu" ]
65+ },
66+ "Debate Team" : {
67+ "description" : "Build public speaking and critical thinking through debates" ,
68+ "schedule" : "Mondays, 3:30 PM - 5:00 PM" ,
69+ "max_participants" : 14 ,
70+ "participants" : ["elijah@mergington.edu" , "james@mergington.edu" ]
71+ },
72+ "Math Olympiad" : {
73+ "description" : "Solve advanced math problems and prepare for competitions" ,
74+ "schedule" : "Fridays, 3:30 PM - 5:00 PM" ,
75+ "max_participants" : 12 ,
76+ "participants" : ["lucas@mergington.edu" , "benjamin@mergington.edu" ]
4177 }
4278}
4379
@@ -62,6 +98,10 @@ def signup_for_activity(activity_name: str, email: str):
6298 # Get the specific 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 = "Student already signed up for this activity" )
104+
65105 # Add student
66106 activity ["participants" ].append (email )
67107 return {"message" : f"Signed up { email } for { activity_name } " }
0 commit comments