3838 "schedule" : "Mondays, Wednesdays, Fridays, 2:00 PM - 3:00 PM" ,
3939 "max_participants" : 30 ,
404041+ },
42+
43+ # --- New Sports Activities ---
44+ "Soccer Team" : {
45+ "description" : "Competitive soccer team practices and matches" ,
46+ "schedule" : "Tuesdays and Thursdays, 4:00 PM - 6:00 PM" ,
47+ "max_participants" : 18 ,
48+ "participants" : [
"[email protected] " ]
49+ },
50+ "Track and Field" : {
51+ "description" : "Track workouts, field events, and seasonal meets" ,
52+ "schedule" : "Mondays, Wednesdays, Fridays, 3:00 PM - 4:30 PM" ,
53+ "max_participants" : 25 ,
54+ "participants" : [
"[email protected] " ]
55+ },
56+
57+ # --- New Artistic Activities ---
58+ "Drama Club" : {
59+ "description" : "Theater rehearsals, acting workshops, and school productions" ,
60+ "schedule" : "Wednesdays, 4:00 PM - 6:00 PM" ,
61+ "max_participants" : 30 ,
62+ "participants" : [
"[email protected] " ]
63+ },
64+ "Photography Club" : {
65+ "description" : "Learn photography techniques and work on creative projects" ,
66+ "schedule" : "Saturdays, 10:00 AM - 12:00 PM" ,
67+ "max_participants" : 15 ,
68+ "participants" : [
"[email protected] " ]
69+ },
70+
71+ # --- New Intellectual Activities ---
72+ "Robotics Club" : {
73+ "description" : "Design, build, and program robots for competitions and demos" ,
74+ "schedule" : "Thursdays, 4:00 PM - 6:00 PM" ,
75+ "max_participants" : 12 ,
76+ "participants" : [
"[email protected] " ]
77+ },
78+ "Math Team" : {
79+ "description" : "Prepare for math competitions and practice challenging problems" ,
80+ "schedule" : "Tuesdays, 5:00 PM - 6:30 PM" ,
81+ "max_participants" : 15 ,
82+ "participants" : [
"[email protected] " ]
4183 }
4284}
4385
@@ -62,6 +104,14 @@ def signup_for_activity(activity_name: str, email: str):
62104 # Get the specific activity
63105 activity = activities [activity_name ]
64106
107+ # Validate student is not already signed up
108+ if email in activity ["participants" ]:
109+ raise HTTPException (status_code = 400 , detail = "Student is already signed up" )
110+
111+ # Validate capacity
112+ if len (activity ["participants" ]) >= activity ["max_participants" ]:
113+ raise HTTPException (status_code = 400 , detail = "Activity is full" )
114+
65115 # Add student
66116 activity ["participants" ].append (email )
67117 return {"message" : f"Signed up { email } for { activity_name } " }
0 commit comments