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+ "Basketball" : {
43+ "description" : "Team sport focusing on basketball skills and competitive play" ,
44+ "schedule" : "Mondays and Wednesdays, 4:00 PM - 5:30 PM" ,
45+ "max_participants" : 15 ,
46+ "participants" : ["alex@mergington.edu" ]
47+ },
48+ "Tennis Club" : {
49+ "description" : "Learn tennis techniques and participate in matches" ,
50+ "schedule" : "Saturdays, 10:00 AM - 11:30 AM" ,
51+ "max_participants" : 10 ,
52+ "participants" : ["james@mergington.edu" ]
53+ },
54+ "Drama Club" : {
55+ "description" : "Perform in theatrical productions and develop acting skills" ,
56+ "schedule" : "Wednesdays and Thursdays, 4:00 PM - 5:30 PM" ,
57+ "max_participants" : 25 ,
58+ "participants" : ["isabella@mergington.edu" , "lucas@mergington.edu" ]
59+ },
60+ "Art Studio" : {
61+ "description" : "Create visual art including painting, drawing, and sculpture" ,
62+ "schedule" : "Tuesdays and Fridays, 3:30 PM - 5:00 PM" ,
63+ "max_participants" : 18 ,
64+ "participants" : ["sophie@mergington.edu" ]
65+ },
66+ "Debate Team" : {
67+ "description" : "Develop public speaking and argumentation skills" ,
68+ "schedule" : "Mondays and Thursdays, 3:30 PM - 4:45 PM" ,
69+ "max_participants" : 16 ,
70+ "participants" : ["noah@mergington.edu" , "ava@mergington.edu" ]
71+ },
72+ "Science Club" : {
73+ "description" : "Explore scientific concepts through experiments and projects" ,
74+ "schedule" : "Wednesdays, 3:30 PM - 5:00 PM" ,
75+ "max_participants" : 20 ,
76+ "participants" : ["ethan@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