This repository was archived by the owner on Jun 7, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed
Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change 2020# -------------------
2121from fastapi import FastAPI , Request , status
2222from fastapi .encoders import jsonable_encoder
23- from fastapi .responses import RedirectResponse , JSONResponse
23+ from fastapi .responses import JSONResponse
2424from fastapi .staticfiles import StaticFiles
2525from pydantic .error_wrappers import ValidationError
2626
Original file line number Diff line number Diff line change @@ -83,16 +83,17 @@ 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 = ""
8687 if await is_instructor (request ):
8788 if not request_data .sid :
88- request_data . sid = user .username
89+ sid = user .username
8990 else :
9091 if request_data .sid :
9192 # someone is attempting to spoof the api
9293 return make_json_response (
9394 status = status .HTTP_401_UNAUTHORIZED , detail = "not an instructor"
9495 )
95- request_data . sid = user .username
96+ sid = user .username
9697
9798 row = await fetch_last_answer_table_entry (request_data )
9899 # mypy complains that ``row.id`` doesn't exist (true, but the return type wasn't exact and this does exist).
@@ -109,9 +110,7 @@ async def get_assessment_results(
109110 ret .update (await rcd .grader (row , feedback ))
110111
111112 # get grade and instructor feedback if Any
112- grades = await fetch_question_grade (
113- request_data .sid , request_data .course , request_data .div_id
114- )
113+ grades = await fetch_question_grade (sid , request_data .course , request_data .div_id )
115114 if grades :
116115 ret ["comment" ] = grades .comment
117116 ret ["score" ] = grades .score
You can’t perform that action at this time.
0 commit comments