3838 "schedule" : "Mondays, Wednesdays, Fridays, 2:00 PM - 3:00 PM" ,
3939 "max_participants" : 30 ,
404041+ },
42+ # Sports related activities
43+ "Soccer Team" : {
44+ "description" : "Join the school soccer team and compete in local matches" ,
45+ "schedule" : "Wednesdays, 4:00 PM - 5:30 PM" ,
46+ "max_participants" : 22 ,
47+ 48+ },
49+ "Basketball Club" : {
50+ "description" : "Practice basketball skills and play friendly games" ,
51+ "schedule" : "Mondays, 3:30 PM - 5:00 PM" ,
52+ "max_participants" : 15 ,
53+ 54+ },
55+ # Artistic activities
56+ "Art Workshop" : {
57+ "description" : "Explore painting, drawing, and sculpture techniques" ,
58+ "schedule" : "Thursdays, 4:00 PM - 5:30 PM" ,
59+ "max_participants" : 18 ,
60+ 61+ },
62+ "Drama Club" : {
63+ "description" : "Act in plays and learn stage performance skills" ,
64+ "schedule" : "Tuesdays, 3:30 PM - 5:00 PM" ,
65+ "max_participants" : 20 ,
66+ 67+ },
68+ # Intellectual activities
69+ "Mathletes" : {
70+ "description" : "Compete in math competitions and solve challenging problems" ,
71+ "schedule" : "Fridays, 4:00 PM - 5:00 PM" ,
72+ "max_participants" : 10 ,
73+ 74+ },
75+ "Science Club" : {
76+ "description" : "Conduct experiments and explore scientific concepts" ,
77+ "schedule" : "Wednesdays, 3:30 PM - 5:00 PM" ,
78+ "max_participants" : 16 ,
79+ 4180 }
4281}
4382
@@ -62,6 +101,10 @@ def signup_for_activity(activity_name: str, email: str):
62101 # Get the specific activity
63102 activity = activities [activity_name ]
64103
104+ # Validate student is not already signed up
105+ if email in activity ["participants" ]:
106+ raise HTTPException (status_code = 400 , detail = "Student already signed up" )
107+
65108 # Add student
66109 activity ["participants" ].append (email )
67110 return {"message" : f"Signed up { email } for { activity_name } " }
0 commit comments