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