From 282c713ead1cf5c77851212b5711c42d62a00fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Gomo=C5=82a?= Date: Fri, 5 Apr 2024 13:41:18 +0200 Subject: [PATCH] Update auth.js --- utils/auth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/auth.js b/utils/auth.js index 63c8ff2..7d94af0 100644 --- a/utils/auth.js +++ b/utils/auth.js @@ -202,7 +202,7 @@ export class MailAuth { 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) => { 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); else resolve();