properly dequeue user and reflect that on frontend
This commit is contained in:
parent
06fa768c84
commit
52746f8a7f
2 changed files with 8 additions and 4 deletions
|
|
@ -311,8 +311,7 @@ function pongClient(
|
||||||
let players = info.players.sort((l, r) => r.score - l.score);
|
let players = info.players.sort((l, r) => r.score - l.score);
|
||||||
|
|
||||||
const medals = ["🥇", "🥈", "🥉"];
|
const medals = ["🥇", "🥈", "🥉"];
|
||||||
if (!render_tour_score_once)
|
if (!render_tour_score_once) {
|
||||||
{
|
|
||||||
tour_scores.innerHTML = tourScoresHtml;
|
tour_scores.innerHTML = tourScoresHtml;
|
||||||
render_tour_score_once = true;
|
render_tour_score_once = true;
|
||||||
}
|
}
|
||||||
|
|
@ -536,7 +535,12 @@ function pongClient(
|
||||||
socket.on("updateInformation", (e) => {
|
socket.on("updateInformation", (e) => {
|
||||||
queue_infos.innerText = `${e.totalUser}👤 ${e.inQueue}⏳ ${e.totalGames}▮•▮`;
|
queue_infos.innerText = `${e.totalUser}👤 ${e.inQueue}⏳ ${e.totalGames}▮•▮`;
|
||||||
});
|
});
|
||||||
socket.on("queueEvent", (e) => showInfo(`QueueEvent: ${e}`)); // MAYBE: play a sound? to notify user that smthing happend
|
socket.on("queueEvent", (e) => {
|
||||||
|
if (e === "registered") queueBtn.innerText = QueueState.InQueu;
|
||||||
|
else if (e === "unregistered")
|
||||||
|
queueBtn.innerText = QueueState.Iddle;
|
||||||
|
showInfo(`QueueEvent: ${e}`);
|
||||||
|
}); // MAYBE: play a sound? to notify user that smthing happend
|
||||||
// ---
|
// ---
|
||||||
// queue evt end
|
// queue evt end
|
||||||
// ---
|
// ---
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ class StateI {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.queue.delete(user.id);
|
this.dequeueUser(user.socket);
|
||||||
this.tournament.addUser(user.id, name ?? udb.name);
|
this.tournament.addUser(user.id, name ?? udb.name);
|
||||||
sock.emit('tournamentRegister', {
|
sock.emit('tournamentRegister', {
|
||||||
kind: 'success',
|
kind: 'success',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue