Skip to content

Commit fddb516

Browse files
committed
ADD chekc to super student add
1 parent a01cfba commit fddb516

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

api/anubis/views/super/students.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,19 @@ def super_students_add(netid: str, name: str):
164164
:return:
165165
"""
166166

167+
user = User.query.filter(User.netid == netid.strip()).first()
168+
if user is not None:
169+
return success_response({
170+
"status": f"Student already exists {netid}",
171+
"user": user.data,
172+
})
173+
167174
user = User(netid=netid.strip(), name=name.strip())
168175
db.session.add(user)
169176
db.session.commit()
170177

171178
return success_response({
172-
"status": f"Added student {netid}"
179+
"status": f"Added student {netid}",
180+
"user": user.data,
173181
})
174182

0 commit comments

Comments
 (0)