Added Answer-Count to admin screen

This commit is contained in:
Mawoka
2023-06-14 17:44:50 +02:00
parent 60d0dee9c3
commit c0875e4c2a
5 changed files with 39 additions and 18 deletions
+25 -13
View File
@@ -31,6 +31,7 @@
let shown_question_now: number;
let final_results_clicked = false;
let timer_interval;
let answer_count = 0;
export let control_visible: boolean;
export let player_scores;
@@ -53,6 +54,7 @@
shown_question_now = data.question_index;
timer_res = quiz_data.questions[data.question_index].time;
selected_question = selected_question + 1;
answer_count = 0;
timer(timer_res);
});
const get_question_results = () => {
@@ -95,6 +97,10 @@
}
});
socket.on('player_answer', (_) => {
answer_count += 1;
});
const timer = (time: string) => {
let seconds = Number(time);
timer_interval = setInterval(() => {
@@ -179,13 +185,13 @@
{/if}
{:else}
<!-- <button
on:click={() => {
set_question_number(selected_question + 1);
}}
class='admin-button'
>Next Question ({selected_question + 2}
)
</button>-->
on:click={() => {
set_question_number(selected_question + 1);
}}
class='admin-button'
>Next Question ({selected_question + 2}
)
</button>-->
{/if}
</div>
</div>
@@ -215,12 +221,18 @@
{@html quiz_data.questions[selected_question].question}
</h1>
<!-- <span class='text-center py-2 text-lg'>{$t('admin_page.time_left')}: {timer_res}</span>-->
<div class="mx-auto my-2">
<CircularTimer
bind:text={timer_res}
bind:progress={circular_progress}
color="#ef4444"
/>
<div class="grid grid-cols-3 my-2">
<span />
<div class="m-auto">
<CircularTimer
bind:text={timer_res}
bind:progress={circular_progress}
color="#ef4444"
/>
</div>
<p class="m-auto text-3xl">
{$t('admin_page.answers_submitted', { answer_count: answer_count })}
</p>
</div>
</div>
{#if quiz_data.questions[selected_question].image !== null}
+7 -3
View File
@@ -181,7 +181,10 @@
"progress": "Progress",
"speed": "Speed",
"upload": "Upload",
"files_library": "Files Library"
"files_library": "Files Library",
"answer_plural": "Answers",
"yes": "Yes",
"no": "no"
},
"editor": {
"time_in_seconds": "Time in seconds",
@@ -229,7 +232,8 @@
"next_question": "Next Question ({{question}})",
"show_results": "Show results",
"stop_time_and_solutions": "Stop time and show solutions",
"enter_answer_into_field": "Enter your answer into the input field!"
"enter_answer_into_field": "Enter your answer into the input field!",
"answers_submitted": "{{answer_count}} Answers submitted"
},
"password_reset_page": {
"reset_password": "Reset password"
@@ -407,7 +411,7 @@
"caption": "Caption: {{caption}}",
"filename": "Filename: {{filename}}",
"uploaded": "Uploaded: {{date}}",
"Imported": "Imported: {{yes_or_no}}",
"imported": "Imported: {{yes_or_no}}",
"edit_details": "Edit details",
"delete_image": "Delete image",
"edit_the_image": "Edit the image",