🐛 Fixed admin crashing when using specific question-types
This commit is contained in:
@@ -4,13 +4,15 @@ SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
|
|||||||
SPDX-License-Identifier: MPL-2.0
|
SPDX-License-Identifier: MPL-2.0
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang='ts'>
|
||||||
import VotingResults from './voting_results.svelte';
|
import VotingResults from './voting_results.svelte';
|
||||||
import { flip } from 'svelte/animate';
|
import { flip } from 'svelte/animate';
|
||||||
import { fly } from 'svelte/transition';
|
import { fly } from 'svelte/transition';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { getLocalization } from '$lib/i18n';
|
import { getLocalization } from '$lib/i18n';
|
||||||
import type { Question } from '$lib/quiz_types';
|
import type { Question } from '$lib/quiz_types';
|
||||||
|
import { QuizQuestionType } from '$lib/quiz_types';
|
||||||
|
|
||||||
const { t } = getLocalization();
|
const { t } = getLocalization();
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
@@ -56,7 +58,7 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
}
|
}
|
||||||
|
|
||||||
$: data = sortObjectbyValue(data);
|
$: data = sortObjectbyValue(data);
|
||||||
$: player_names = Object.keys(data).sort(function (a, b) {
|
$: player_names = Object.keys(data).sort(function(a, b) {
|
||||||
return data[b] - data[a];
|
return data[b] - data[a];
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -92,30 +94,30 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
// https://svelte.dev/repl/96a58afdea2248a5b7e489160ffba887?version=3.44.2
|
// https://svelte.dev/repl/96a58afdea2248a5b7e489160ffba887?version=3.44.2
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="h-full flex flex-col">
|
<div class='h-full flex flex-col'>
|
||||||
<div class="flex justify-center">
|
<div class='flex justify-center'>
|
||||||
<div>
|
<div>
|
||||||
<table class="table-auto text-xl">
|
<table class='table-auto text-xl'>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="p-2 border-r border-r-black border-b-2 border-b-black"
|
<th class='p-2 border-r border-r-black border-b-2 border-b-black'
|
||||||
>{$t('words.name')}</th
|
>{$t('words.name')}</th
|
||||||
>
|
>
|
||||||
<th class="p-2 border-b-2 border-b-black">{$t('words.point', { count: 2 })}</th>
|
<th class='p-2 border-b-2 border-b-black'>{$t('words.point', { count: 2 })}</th>
|
||||||
{#if show_new_score_clicked}
|
{#if show_new_score_clicked}
|
||||||
<th in:fly={{ x: 300 }} class="p-2 border-b-2 border-b-black"
|
<th in:fly={{ x: 300 }} class='p-2 border-b-2 border-b-black'
|
||||||
>{$t('play_page.points_added')}
|
>{$t('play_page.points_added')}
|
||||||
</th>
|
</th>
|
||||||
{/if}
|
{/if}
|
||||||
</tr>
|
</tr>
|
||||||
{#each player_names as player, i (player)}
|
{#each player_names as player, i (player)}
|
||||||
<tr animate:flip>
|
<tr animate:flip>
|
||||||
<td class:hidden={i > 3} class="p-2 border-r border-r-black">{player}</td>
|
<td class:hidden={i > 3} class='p-2 border-r border-r-black'>{player}</td>
|
||||||
<td class:hidden={i > 3} class="p-2">{data[player]}</td>
|
<td class:hidden={i > 3} class='p-2'>{data[player]}</td>
|
||||||
{#if show_new_score_clicked}
|
{#if show_new_score_clicked}
|
||||||
<td
|
<td
|
||||||
in:fly={{ x: 300 }}
|
in:fly={{ x: 300 }}
|
||||||
class:hidden={i > 3}
|
class:hidden={i > 3}
|
||||||
class="p-2"
|
class='p-2'
|
||||||
class:text-red-600={score_by_username[player] === 0 ||
|
class:text-red-600={score_by_username[player] === 0 ||
|
||||||
score_by_username[player] === undefined}
|
score_by_username[player] === undefined}
|
||||||
>
|
>
|
||||||
@@ -127,7 +129,9 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-12">
|
{#if [QuizQuestionType.ABCD, QuizQuestionType.VOTING, QuizQuestionType.TEXT].includes(question.type)}
|
||||||
|
<div class='mt-12'>
|
||||||
<VotingResults data={new_data} {question} />
|
<VotingResults data={new_data} {question} />
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user