Skip to content

Commit bf2b713

Browse files
authored
username, quiz (#19)
* username and domain submit fixes * minor fixes
1 parent c681993 commit bf2b713

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

routes/domain.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,16 @@ async def get_qs(domain: str):
5353
if not qs:
5454
raise HTTPException(status_code=404, detail="Questions not found")
5555

56-
return {"questions": qs}
56+
formatted_questions = []
57+
for question in qs:
58+
formatted_question = {
59+
"question": question.get("question"),
60+
"answers": question.get("answers"),
61+
"correctAnswer": question.get("correctAnswer"),
62+
}
63+
formatted_questions.append(formatted_question)
64+
65+
return {"questions": formatted_questions}
5766

5867
except Exception as e:
59-
raise HTTPException(status_code=400, detail=f"Error: {str(e)}")
68+
raise HTTPException(status_code=400, detail=f"Error: {str(e)}")

routes/user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async def login(authorization: str = Depends(get_access_token), resources: dict
3737
raise HTTPException(status_code=500, detail=f"Database lookup failed: {str(db_error)}")
3838

3939
if user is None:
40-
return JSONResponse(status_code=404, content="User not registered on VTOP")
40+
return JSONResponse(content={"message": "User not registered on VTOP"}, status_code=204)
4141

4242
if 'username' not in user:
4343
return JSONResponse(status_code=201, content="Logged In Successfully")

0 commit comments

Comments
 (0)