🥅 Added info why quiz can't get imported
This commit is contained in:
@@ -3,6 +3,8 @@ import uuid
|
||||
from datetime import datetime
|
||||
from random import randint
|
||||
|
||||
from pydantic import ValidationError
|
||||
|
||||
from classquiz.kahoot_importer.import_quiz import import_quiz
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from fastapi.responses import JSONResponse
|
||||
@@ -103,7 +105,10 @@ async def update_quiz(quiz_id: str, quiz_input: QuizInput, user: User = Depends(
|
||||
|
||||
@router.post("/import/{quiz_id}")
|
||||
async def import_quiz_route(quiz_id: str, user: User = Depends(get_current_user)):
|
||||
return await import_quiz(quiz_id, user)
|
||||
try:
|
||||
return await import_quiz(quiz_id, user)
|
||||
except ValidationError:
|
||||
raise HTTPException(status_code=400, detail="THis quiz in't (yet) supported")
|
||||
|
||||
|
||||
@router.delete("/delete/{quiz_id}")
|
||||
|
||||
@@ -61,5 +61,4 @@ async def test_get():
|
||||
rounds = 0
|
||||
for i in quiz_list:
|
||||
rounds = rounds + 1
|
||||
print(f"Got {rounds} from {len(quiz_list)}")
|
||||
await get(i)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<h4>Frontend</h4>
|
||||
<ul>
|
||||
<li><a href="https://pnpm.io/">pNpM</a></li>
|
||||
<li><a href="https://pnpm.io/">pnpm</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Setup</h2>
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
|
||||
if (res.status === 200) {
|
||||
window.location.href = '/overview';
|
||||
} else if (res.status === 400) {
|
||||
alert("This quiz isn't (yet) supported!");
|
||||
} else {
|
||||
alert('Error importing quiz');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user