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