🐛 Fixed #82

This commit is contained in:
Mawoka
2022-08-26 18:46:03 +02:00
parent 6d3a27f566
commit f1c463c2d7
6 changed files with 128 additions and 82 deletions
+3 -3
View File
@@ -29,7 +29,7 @@
let game_started = false;
let quiz_data: QuizData;
//let question_number = '0';
let question_results = null;
// let question_results = null;
let final_results: Array<null> | Array<Array<PlayerAnswer>> = [null];
let success = false;
let dataexport_download_a;
@@ -58,7 +58,7 @@
errorMessage = $t('admin_page.already_registered_as_admin');
});
socket.on('question_results', (int_data) => {
/* socket.on('question_results', (int_data) => {
try {
int_data = JSON.parse(int_data);
} catch (e) {
@@ -66,7 +66,7 @@
return;
}
question_results = int_data;
});
});*/
socket.on('export_token', (int_data) => {
warnToLeave = false;
dataexport_download_a.href = `/api/v1/quiz/export_data/${int_data}?ts=${new Date().getTime()}&game_pin=${game_pin}`;
+21 -8
View File
@@ -9,6 +9,9 @@
import { navbarVisible } from '$lib/stores';
import ShowEndScreen from '$lib/play/end.svelte';
import { QuizQuestionType } from '$lib/quiz_types';
import { getLocalization } from '$lib/i18n';
const { t } = getLocalization();
// Exports
export let data;
@@ -83,7 +86,11 @@
socket.on('question_results', (data) => {
restart();
answer_results = JSON.parse(data);
try {
answer_results = JSON.parse(data);
} catch {
answer_results = null;
}
});
socket.on('final_results', (data) => {
@@ -124,12 +131,18 @@
/>
{/key}
{:else if gameMeta.started && answer_results !== undefined}
{#key unique}
<ShowResults
bind:results={answer_results}
bind:game_data={gameData}
bind:question_index
/>
{/key}
{#if answer_results === null}
<div class="w-full flex justify-center">
<h1 class="text-3xl">{$t('admin_page.no_answers')}</h1>
</div>
{:else}
{#key unique}
<ShowResults
bind:results={answer_results}
bind:game_data={gameData}
bind:question_index
/>
{/key}
{/if}
{/if}
</div>