38
38
"schedule" : "Mondays, Wednesdays, Fridays, 2:00 PM - 3:00 PM" ,
39
39
"max_participants" : 30 ,
40
40
"participants" : ["john@mergington.edu" , "olivia@mergington.edu" ]
41
+ },
42
+ "Soccer Team" : {
43
+ "description" : "Join the school soccer team and compete in matches" ,
44
+ "schedule" : "Tuesdays and Thursdays, 4:00 PM - 5:30 PM" ,
45
+ "max_participants" : 22 ,
46
+ "participants" : ["liam@mergington.edu" , "noah@mergington.edu" ]
47
+ },
48
+ "Basketball Team" : {
49
+ "description" : "Practice basketball skills and participate in tournaments" ,
50
+ "schedule" : "Wednesdays and Fridays, 3:30 PM - 5:00 PM" ,
51
+ "max_participants" : 15 ,
52
+ "participants" : ["ava@mergington.edu" , "mia@mergington.edu" ]
53
+ },
54
+ "Art Club" : {
55
+ "description" : "Explore various art techniques and create your own masterpieces" ,
56
+ "schedule" : "Thursdays, 3:30 PM - 5:00 PM" ,
57
+ "max_participants" : 15 ,
58
+ "participants" : ["amelia@mergington.edu" , "harper@mergington.edu" ]
59
+ },
60
+ "Drama Club" : {
61
+ "description" : "Learn acting skills and participate in school plays" ,
62
+ "schedule" : "Mondays and Wednesdays, 4:00 PM - 5:30 PM" ,
63
+ "max_participants" : 20 ,
64
+ "participants" : ["ella@mergington.edu" , "scarlett@mergington.edu" ]
65
+ },
66
+ "Math Club" : {
67
+ "description" : "Solve challenging math problems and prepare for competitions" ,
68
+ "schedule" : "Tuesdays, 3:30 PM - 4:30 PM" ,
69
+ "max_participants" : 10 ,
70
+ "participants" : ["james@mergington.edu" , "benjamin@mergington.edu" ]
71
+ },
72
+ "Science Club" : {
73
+ "description" : "Conduct experiments and explore scientific concepts" ,
74
+ "schedule" : "Fridays, 3:30 PM - 5:00 PM" ,
75
+ "max_participants" : 12 ,
76
+ "participants" : ["elijah@mergington.edu" , "lucas@mergington.edu" ]
41
77
}
42
78
}
43
79
@@ -61,6 +97,9 @@ def signup_for_activity(activity_name: str, email: str):
61
97
62
98
# Get the specificy activity
63
99
activity = activities [activity_name ]
100
+ # Validate student is not already signed up
101
+ if email in activity ["participants" ]:
102
+ raise HTTPException (status_code = 400 , detail = "Already signed up for this activity" )
64
103
65
104
# Add student
66
105
activity ["participants" ].append (email )
0 commit comments