✨ Updated admin-join-screen
This commit is contained in:
@@ -433,6 +433,8 @@ async def submit_answer(sid: str, data: dict):
|
|||||||
score = calculate_score(
|
score = calculate_score(
|
||||||
abs(diff) - latency, int(float(game_data.questions[int(float(data.question_index))].time))
|
abs(diff) - latency, int(float(game_data.questions[int(float(data.question_index))].time))
|
||||||
)
|
)
|
||||||
|
if score > 1000:
|
||||||
|
score = 1000
|
||||||
await redis.hincrby(f"game_session:{session['game_pin']}:player_scores", session["username"], score)
|
await redis.hincrby(f"game_session:{session['game_pin']}:player_scores", session["username"], score)
|
||||||
answer_data = AnswerData(
|
answer_data = AnswerData(
|
||||||
username=session["username"],
|
username=session["username"],
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ 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 AudioPlayer from '$lib/play/audio_player.svelte';
|
import AudioPlayer from '$lib/play/audio_player.svelte';
|
||||||
import ControllerCodeDisplay from '$lib/components/controller/code.svelte';
|
import ControllerCodeDisplay from '$lib/components/controller/code.svelte';
|
||||||
import { getLocalization } from '$lib/i18n';
|
import { getLocalization } from '$lib/i18n';
|
||||||
|
import GrayButton from '$lib/components/buttons/gray.svelte';
|
||||||
|
|
||||||
export let game_pin: string;
|
export let game_pin: string;
|
||||||
export let players;
|
export let players;
|
||||||
@@ -34,11 +35,11 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="w-full h-full">
|
<div class='w-full h-full'>
|
||||||
<AudioPlayer bind:play={play_music} />
|
<AudioPlayer bind:play={play_music} />
|
||||||
<div class="grid grid-cols-3 mt-12">
|
<div class='grid grid-cols-3 mt-12'>
|
||||||
<div class="flex justify-center">
|
<div class='flex justify-center'>
|
||||||
<p class="m-auto text-2xl">
|
<p class='m-auto text-2xl'>
|
||||||
{$t('play_page.join_description', {
|
{$t('play_page.join_description', {
|
||||||
url:
|
url:
|
||||||
window.location.host === 'classquiz.de'
|
window.location.host === 'classquiz.de'
|
||||||
@@ -49,47 +50,45 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<img
|
<img
|
||||||
alt="QR code to join the game"
|
alt='QR code to join the game'
|
||||||
src="/api/v1/utils/qr/{game_pin}"
|
src='/api/v1/utils/qr/{game_pin}'
|
||||||
class="block mx-auto w-1/2 dark:bg-white"
|
class='block mx-auto w-1/2 dark:bg-white shadow-2xl rounded'
|
||||||
/>
|
/>
|
||||||
{#if cqc_code}
|
{#if cqc_code}
|
||||||
<div class="m-auto">
|
<div class='m-auto'>
|
||||||
<div class="flex-col flex justify-center">
|
<div class='flex-col flex justify-center'>
|
||||||
<p class="mx-auto">{$t('play_page.join_by_entering_code')}</p>
|
<p class='mx-auto'>{$t('play_page.join_by_entering_code')}</p>
|
||||||
<ControllerCodeDisplay code={cqc_code} />
|
<ControllerCodeDisplay code={cqc_code} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<p class="text-3xl text-center">{$t('words.pin')}: {game_pin}</p>
|
<p class='text-3xl text-center'>{$t('words.pin')}: <span class='select-all'>{game_pin}</span></p>
|
||||||
<div class="flex justify-center w-full mt-4">
|
<div class='flex justify-center w-full mt-4'>
|
||||||
<ul class="list-disc pl-8">
|
<div>
|
||||||
|
<GrayButton
|
||||||
|
disabled={players.length < 1}
|
||||||
|
on:click={() => {
|
||||||
|
socket.emit('start_game', '');
|
||||||
|
}}
|
||||||
|
>{$t('admin_page.start_game')}
|
||||||
|
</GrayButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class='flex flex-row w-full mt-4 px-10 flex-wrap'>
|
||||||
{#if players.length > 0}
|
{#if players.length > 0}
|
||||||
{#each players as player}
|
{#each players as player}
|
||||||
<li>
|
<div class='p-2 m-2 border-2 border-[#B07156] rounded hover:cursor-pointer'>
|
||||||
<span
|
<span
|
||||||
class="hover:line-through"
|
class='hover:line-through text-lg'
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
kick_player(player.username);
|
kick_player(player.username);
|
||||||
}}>{player.username}</span
|
}}>{player.username}</span
|
||||||
>
|
>
|
||||||
<!-- <button>{$t('words.kick')}</button>-->
|
<!-- <button>{$t('words.kick')}</button>-->
|
||||||
</li>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
{#if players.length > 0}
|
|
||||||
<div class="flex justify-center w-full mt-4">
|
|
||||||
<button
|
|
||||||
class="ml-4 admin-button"
|
|
||||||
id="startGame"
|
|
||||||
on:click={() => {
|
|
||||||
socket.emit('start_game', '');
|
|
||||||
}}
|
|
||||||
>{$t('admin_page.start_game')}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user