From 6788b32131e6f593d44de0a7f106516312c9cc27 Mon Sep 17 00:00:00 2001 From: Mawoka Date: Wed, 18 Jan 2023 20:34:37 +0100 Subject: [PATCH] BROKEN quick save --- classquiz/socket_server/__init__.py | 1 + frontend/src/lib/dashboard/main_slider.svelte | 12 ++ .../src/lib/editor/OrderEditorPart.svelte | 2 +- frontend/src/lib/practice/question.svelte | 128 ++++++++++++++---- .../src/routes/view/[quiz_id]/+page.svelte | 10 ++ 5 files changed, 128 insertions(+), 25 deletions(-) diff --git a/classquiz/socket_server/__init__.py b/classquiz/socket_server/__init__.py index ba566d8..04c235d 100644 --- a/classquiz/socket_server/__init__.py +++ b/classquiz/socket_server/__init__.py @@ -322,6 +322,7 @@ async def submit_answer(sid: str, data: dict): print(data.dict()["complex_answer"], correct_answers) if correct_answers == data.dict()["complex_answer"]: answer_right = True + # TODO Set data.answer to a real value for export elif game_data.questions[int(float(data.question_index))].type == QuizQuestionType.TEXT: answer_right = False diff --git a/frontend/src/lib/dashboard/main_slider.svelte b/frontend/src/lib/dashboard/main_slider.svelte index fbe0e87..810d9dc 100644 --- a/frontend/src/lib/dashboard/main_slider.svelte +++ b/frontend/src/lib/dashboard/main_slider.svelte @@ -371,6 +371,18 @@ {/each} + {:else if question.type === QuizQuestionType.ORDER} + {:else if question.type === QuizQuestionType.SLIDE}
{#each data.questions[selected_question].answers as answer, i (answer.id)}
diff --git a/frontend/src/lib/practice/question.svelte b/frontend/src/lib/practice/question.svelte index 9b22577..8fa3749 100644 --- a/frontend/src/lib/practice/question.svelte +++ b/frontend/src/lib/practice/question.svelte @@ -3,12 +3,13 @@ - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at https://mozilla.org/MPL/2.0/. --> - -
-

{@html question.question}

+
+

{@html question.question}

{#if question.image !== null}
Content for Question
{/if} -

{timer_res}

+

{timer_res}

{#if question.type === QuizQuestionType.ABCD} {#if show_results}
@@ -65,8 +75,8 @@ class:bg-red-500={!question.answers[i].right} class:text-xl={i === selected_answer} class:underline={i === selected_answer} - class="p-2 rounded-lg flex justify-center w-full transition my-5 text-black" - >{answer.answer}{answer.answer} {/each}
@@ -75,7 +85,7 @@ {#each question.answers as answer, i} {:then c} -
+
{/await} @@ -121,18 +131,18 @@ bind:max={question.answers.max} pips float - all="label" + all='label' />
-
+
{/await} @@ -141,7 +151,7 @@ {#each question.answers as answer, i}
{/if} +
+ {#each question.answers as answer, i (answer.id)} +
+ +

{answer.answer}

+ + +
+ {/each} + {/if}
diff --git a/frontend/src/routes/view/[quiz_id]/+page.svelte b/frontend/src/routes/view/[quiz_id]/+page.svelte index ebb0666..b9fd687 100644 --- a/frontend/src/routes/view/[quiz_id]/+page.svelte +++ b/frontend/src/routes/view/[quiz_id]/+page.svelte @@ -218,6 +218,16 @@ and {question.answers.max_correct} are correct, where numbers between {question .answers.min} and {question.answers.max} can be selected.

+ {:else if question.type === QuizQuestionType.ORDER} +
    + {#each question.answers as answer} +
  • +

    + {answer.answer} +

    +
  • + {/each} +
{:else if question.type === QuizQuestionType.VOTING || question.type === QuizQuestionType.TEXT}
{#each question.answers as answer, index_answer}