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}