Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit dc4fa1e

Browse files
committed
Fix: make sure sid is always set right.
1 parent bf1bf68 commit dc4fa1e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

bookserver/routers/assessment.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,16 @@ async def get_assessment_results(
8383
# Otherwise if the user is an instructor then use the provided
8484
# sid (it could be any student in the class). If none is provided then
8585
# use the user objects username
86-
sid = ""
86+
sid = user.username
8787
if await is_instructor(request):
88-
if not request_data.sid:
89-
sid = user.username
88+
if request_data.sid:
89+
sid = request_data.sid
9090
else:
9191
if request_data.sid:
9292
# someone is attempting to spoof the api
9393
return make_json_response(
9494
status=status.HTTP_401_UNAUTHORIZED, detail="not an instructor"
9595
)
96-
sid = user.username
9796

9897
row = await fetch_last_answer_table_entry(request_data)
9998
# mypy complains that ``row.id`` doesn't exist (true, but the return type wasn't exact and this does exist).

0 commit comments

Comments
 (0)