[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2026-04-22 22:42:01 +00:00
parent 68c905f199
commit fc339e3ff1
3 changed files with 38 additions and 39 deletions
+14 -14
View File
@@ -2,18 +2,18 @@ import type { Player, PlayerAnswer } from '$lib/admin.ts';
import { QuizData } from '$lib/quiz_types'; import { QuizData } from '$lib/quiz_types';
export interface IGameState { export interface IGameState {
game_id: string; game_id: string;
players: Player[]; players: Player[];
player_scores: Record<string, number>; player_scores: Record<string, number>;
selected_question: number; selected_question: number;
timer_res: string; timer_res: string;
question_results: any; question_results: any;
answer_count: number; answer_count: number;
shown_question_now: number; shown_question_now: number;
final_results: Array<null> | Array<Array<PlayerAnswer>>; final_results: Array<null> | Array<Array<PlayerAnswer>>;
game_started: boolean; game_started: boolean;
quiz_data: QuizData; quiz_data: QuizData;
control_visible: boolean; control_visible: boolean;
constructor(game_id: string); constructor(game_id: string);
} }
@@ -1,4 +1,3 @@
import type { Socket } from 'socket.io-client'; import type { Socket } from 'socket.io-client';
/** /**
@@ -6,45 +5,45 @@ import type { Socket } from 'socket.io-client';
* Still in development, but it will be used to avoid having socket calls directly in the svelte files, and to have a single place to manage all the game controls related socket calls. * Still in development, but it will be used to avoid having socket calls directly in the svelte files, and to have a single place to manage all the game controls related socket calls.
*/ */
export class SocketGameControls { export class SocketGameControls {
socket: Socket; socket: Socket;
constructor(socket: Socket) { constructor(socket: Socket) {
this.socket = socket; this.socket = socket;
} }
set_question_number(q_number: number) { set_question_number(q_number: number) {
this.socket.emit('set_question_number', q_number.toString()); this.socket.emit('set_question_number', q_number.toString());
}; }
get_question_results(game_id: string, question_number: number) { get_question_results(game_id: string, question_number: number) {
this.socket.emit('get_question_results', { this.socket.emit('get_question_results', {
game_id, game_id,
question_number question_number
}); });
}; }
show_solutions() { show_solutions() {
this.socket.emit('show_solutions', {}); this.socket.emit('show_solutions', {});
}; }
get_final_results() { get_final_results() {
this.socket.emit('get_final_results', {}); this.socket.emit('get_final_results', {});
}; }
start_game() { start_game() {
this.socket.emit('start_game', ''); this.socket.emit('start_game', '');
} }
kick_player(username: string, players: any[]) { kick_player(username: string, players: any[]) {
this.socket.emit('kick_player', { username: username }); this.socket.emit('kick_player', { username: username });
for (let i = 0; i < players.length; i++) { for (let i = 0; i < players.length; i++) {
console.log(players[i].username, username); console.log(players[i].username, username);
if (players[i].username === username) { if (players[i].username === username) {
players.splice(i, 1); players.splice(i, 1);
break; break;
} }
} }
return players; return players;
} }
} }
+1 -1
View File
@@ -308,4 +308,4 @@ SPDX-License-Identifier: MPL-2.0
bind:this={dataexport_download_a} bind:this={dataexport_download_a}
download="" download=""
class="absolute -top-3/4 -left-3/4 opacity-0">Download</a class="absolute -top-3/4 -left-3/4 opacity-0">Download</a
> >