From d38ca037502b0302111a429ccac9c63dd9185496 Mon Sep 17 00:00:00 2001 From: Mawoka Date: Wed, 9 Mar 2022 18:50:03 +0100 Subject: [PATCH] :sparkles: Finished kahoot-import --- classquiz/kahoot_importer/import_quiz.py | 1 + frontend/src/routes/import.svelte | 67 +++++++ frontend/src/routes/index.svelte | 2 +- frontend/src/routes/overview.svelte | 242 ++++++++++++----------- 4 files changed, 193 insertions(+), 119 deletions(-) create mode 100644 frontend/src/routes/import.svelte diff --git a/classquiz/kahoot_importer/import_quiz.py b/classquiz/kahoot_importer/import_quiz.py index 8b4eb7f..7275acd 100644 --- a/classquiz/kahoot_importer/import_quiz.py +++ b/classquiz/kahoot_importer/import_quiz.py @@ -11,6 +11,7 @@ from classquiz.kahoot_importer.get import get as get_quiz async def import_quiz(quiz_id: str, user: User) -> Quiz | str: """ Imports a quiz from Kahoot. + :param user: The user object :param quiz_id: The ID of the quiz to import. :return: True if the import was successful, False otherwise. """ diff --git a/frontend/src/routes/import.svelte b/frontend/src/routes/import.svelte new file mode 100644 index 0000000..c0c4afd --- /dev/null +++ b/frontend/src/routes/import.svelte @@ -0,0 +1,67 @@ + + + + +{#if is_loading} + + + + +{:else} + +
+ + +
+{/if} \ No newline at end of file diff --git a/frontend/src/routes/index.svelte b/frontend/src/routes/index.svelte index 8036f8c..69f1528 100644 --- a/frontend/src/routes/index.svelte +++ b/frontend/src/routes/index.svelte @@ -15,7 +15,7 @@

ClassQuiz is a quiz-platform that allows you to create and manage quizzes.
- Other than that, there are no features. + The main feature is a KAHOOT!-import function that allows you to import quizzes from KAHOOT!-quizzes.

diff --git a/frontend/src/routes/overview.svelte b/frontend/src/routes/overview.svelte index 362b428..5cca791 100644 --- a/frontend/src/routes/overview.svelte +++ b/frontend/src/routes/overview.svelte @@ -1,4 +1,4 @@ - - {#await getData()} - + {:then quizzes} -
+
-
+ -
-
-
- - - - - - - - - - - +
+
+
+
- Title - - Created at - - Question count - - Play - - Edit - - Delete - - Public -
+ + + + + + + + + + - - {#each quizzes as quiz} - - - - - + + + + - - + + - - - {/each} + Delete + + + + + {/each}
+ Title + + Created at + + Question count + + Play + + Edit + + Delete + + Public +
- {quiz.title} - - {formatDate(quiz.created_at)} - - {quiz.questions.length} - -
+ {quiz.title} + + {formatDate(quiz.created_at)} + + {quiz.questions.length} + + - - Edit - - + + Edit + + - - {#if quiz.public} - ✅ - {:else} - ❌ - {/if} -
+ {#if quiz.public} + ✅ + {:else} + ❌ + {/if} +