mirror of
https://github.com/MaciejkaG/statki.git
synced 2024-11-30 07:42:54 +01:00
Compare commits
2 Commits
b1a822f39e
...
282c713ead
Author | SHA1 | Date | |
---|---|---|---|
282c713ead | |||
af64ae982b |
2
index.js
2
index.js
@ -632,8 +632,8 @@ function endGame(gameId) {
|
|||||||
for (let i = 0; i < members.length; i++) {
|
for (let i = 0; i < members.length; i++) {
|
||||||
const sid = members[i][0];
|
const sid = members[i][0];
|
||||||
const socket = io.sockets.sockets.get(sid);
|
const socket = io.sockets.sockets.get(sid);
|
||||||
resetUserGame(socket.request);
|
|
||||||
socket.leave(gameId);
|
socket.leave(gameId);
|
||||||
|
resetUserGame(socket.request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ export class MailAuth {
|
|||||||
const conn = mysql.createConnection(this.mysqlOptions);
|
const conn = mysql.createConnection(this.mysqlOptions);
|
||||||
conn.query(`INSERT INTO matches(match_id, match_type, host_id, guest_id, duration) VALUES (${conn.escape(matchId)}, ${conn.escape(type)}, ${conn.escape(hostId)}, ${conn.escape(guestId)}, ${conn.escape(duration)})`, async (error) => {
|
conn.query(`INSERT INTO matches(match_id, match_type, host_id, guest_id, duration) VALUES (${conn.escape(matchId)}, ${conn.escape(type)}, ${conn.escape(hostId)}, ${conn.escape(guestId)}, ${conn.escape(duration)})`, async (error) => {
|
||||||
if (error) reject(error);
|
if (error) reject(error);
|
||||||
else conn.query(`INSERT INTO statistics(match_id, user_id, board, won) VALUES (${conn.escape(matchId)}, ${conn.escape(hostId)}, ${conn.escape(JSON.stringify(boards[0]))}, ${conn.escape(winnerIdx == 0 ? 1 : 0)}), (${conn.escape(matchId)}, ${conn.escape(guestId)}, ${conn.escape(JSON.stringify(boards[1]))}, ${conn.escape(winnerIdx == 1 ? 1 : 0)})`, async (error, response) => {
|
else conn.query(`INSERT INTO statistics(match_id, user_id, board, won) VALUES (${conn.escape(matchId)}, ${conn.escape(hostId)}, ${conn.escape(JSON.stringify(boards[0]))}, ${conn.escape(!winnerIdx ? 1 : 0)}), (${conn.escape(matchId)}, ${conn.escape(guestId)}, ${conn.escape(JSON.stringify(boards[1]))}, ${conn.escape(winnerIdx ? 1 : 0)})`, async (error, response) => {
|
||||||
if (error) reject(error);
|
if (error) reject(error);
|
||||||
else resolve();
|
else resolve();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user