2525 "description" : "Learn strategies and compete in chess tournaments" ,
2626 "schedule" : "Fridays, 3:30 PM - 5:00 PM" ,
2727 "max_participants" : 12 ,
28- 28+ 2929 },
3030 "Programming Class" : {
3131 "description" : "Learn programming fundamentals and build software projects" ,
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+ 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
44-
4586@app .get ("/" )
4687def root ():
4788 return RedirectResponse (url = "/static/index.html" )
@@ -62,6 +103,14 @@ def signup_for_activity(activity_name: str, email: str):
62103 # Get the specific activity
63104 activity = activities [activity_name ]
64105
106+ # Validate student is not already signed up
107+ if email in activity ["participants" ]:
108+ raise HTTPException (status_code = 400 , detail = "Student is already signed up" )
109+
110+ # Validate capacity
111+ if len (activity ["participants" ]) >= activity ["max_participants" ]:
112+ raise HTTPException (status_code = 400 , detail = "Activity is full" )
113+
65114 # Add student
66115 activity ["participants" ].append (email )
67116 return {"message" : f"Signed up { email } for { activity_name } " }
0 commit comments