🐛 Fixed play-screen
This commit is contained in:
@@ -57,7 +57,7 @@ async def join_game(sid, data):
|
||||
{"username": data["username"], "sid": sid},
|
||||
room=redis_res["admin"],
|
||||
)
|
||||
sio.enter_room(sid, data["game_pin"]) # TODO: make more secure
|
||||
sio.enter_room(sid, data["game_pin"])
|
||||
|
||||
|
||||
@sio.event
|
||||
|
||||
@@ -10,7 +10,7 @@ module.exports = {
|
||||
trans: false,
|
||||
|
||||
// Create and update files `en.json`, `fr.json`, `es.json`
|
||||
lngs: ['en', 'de', 'fr'],
|
||||
lngs: ['en'],
|
||||
|
||||
ns: [
|
||||
// The namespace I use
|
||||
|
||||
@@ -110,7 +110,9 @@
|
||||
"already_registered_as_admin": "There is already an admin registered for this game.",
|
||||
"start_game": "Start game",
|
||||
"time_left": "Time left",
|
||||
"get_results": "Get results"
|
||||
"get_results": "Get results",
|
||||
"get_results_and_stop_time": "Get results and stop time",
|
||||
"get_final_results": "Get final results"
|
||||
},
|
||||
"password_reset_page": {
|
||||
"reset_password": "Reset password"
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
{#if winners_arr.length >= 3}
|
||||
<div>
|
||||
<p class="text-xl text-center">
|
||||
2nd Place: <span class="underline">{winners_arr[3]}</span><span
|
||||
3nd Place: <span class="underline">{winners_arr[3]}</span><span
|
||||
>With {winners[winners_arr[3]]}</span
|
||||
>
|
||||
</p>
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
game_id: game_token,
|
||||
question_number: shown_question_now
|
||||
});
|
||||
timer_res = '0';
|
||||
};
|
||||
|
||||
const getWinnersSorted = () => {
|
||||
@@ -174,6 +175,17 @@
|
||||
event.preventDefault();
|
||||
event.returnValue = '';
|
||||
};
|
||||
|
||||
const get_question_title = (q_number: number): string => {
|
||||
if (q_number - 1 === quiz_data.questions.length) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
return quiz_data.questions[q_number].question;
|
||||
} catch (e) {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<svelte:window on:beforeunload={confirmUnload} />
|
||||
@@ -222,9 +234,10 @@
|
||||
{/if}
|
||||
<br />
|
||||
{#if timer_res === '0'}
|
||||
{#if question_results === null}
|
||||
<button on:click={get_question_results}>{$t('admin_page.get_results')}</button>
|
||||
<br />
|
||||
{#if question_results !== null}
|
||||
{:else}
|
||||
<br />
|
||||
<ul>
|
||||
{#each question_results as result}
|
||||
@@ -232,6 +245,9 @@
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
{:else if timer_res !== undefined}
|
||||
<button on:click={get_question_results}>{$t('admin_page.get_results_and_stop_time')}</button
|
||||
>
|
||||
{/if}
|
||||
<br />
|
||||
<!--{#each quiz_data.questions as { question }, index}
|
||||
@@ -242,14 +258,20 @@
|
||||
>
|
||||
<br />
|
||||
{/each}-->
|
||||
{#if get_question_title(selected_question + 1) !== ''}
|
||||
<button
|
||||
disabled={!(timer_res === undefined || timer_res === '0')}
|
||||
on:click={() => {
|
||||
set_question_number(selected_question + 1);
|
||||
}}>{selected_question + 1}: {quiz_data.questions[selected_question + 1].question}</button
|
||||
}}>{selected_question + 1}: {get_question_title(selected_question + 1)}</button
|
||||
>
|
||||
<br />
|
||||
{#if selected_question === quiz_data.questions.length}
|
||||
<button on:click={get_final_results}>Get final results</button>
|
||||
{:else}
|
||||
<button on:click={get_final_results}>{$t('admin_page.get_final_results')}</button>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if JSON.stringify(final_results) !== JSON.stringify([null])}
|
||||
{#await import('$lib/play/end.svelte') then c}
|
||||
<svelte:component this={c.default} bind:final_results bind:quiz_data />
|
||||
{/await}
|
||||
{/if}
|
||||
|
||||
@@ -117,6 +117,7 @@
|
||||
{$t('words.settings')}
|
||||
</a>
|
||||
</div>
|
||||
{#if quizzes.length !== 0}
|
||||
<div class="overflow-x-auto sm:-mx-8 lg:-mx-8">
|
||||
<div class="inline-block py-2 min-w-full sm:px-6 lg:px-8">
|
||||
<div class="overflow-hidden shadow-md sm:rounded-lg">
|
||||
@@ -236,6 +237,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<p>
|
||||
Looks like you don't have any quizzes. Wanna change that? Click the
|
||||
"Create"-button, or import a quiz from KAHOOT!
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{:catch err}
|
||||
<p>{err}</p>
|
||||
|
||||
Reference in New Issue
Block a user