From c0b33c2144ca5a85ff2afa32f498a3ac74dc4372 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 25 May 2026 09:44:34 +0000 Subject: [PATCH] fix: missing brace in ranked score block --- server.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/server.js b/server.js index 43d9e7b..c452e6b 100644 --- a/server.js +++ b/server.js @@ -439,22 +439,25 @@ app.post("/api/matches/:id/verify", (req, res) => { score.confirmed_at = new Date().toISOString(); // Update player wins/losses (idempotent via player_match_stats tabel) - for (const pid of score.team1) { - const p = db.getPlayer(String(pid)); - if (p && !db.hasMatchStat(String(pid), m.id)) { - db.updatePlayer(String(pid), { wins: (p.wins || 0) + 1, games: (p.games || 0) + 1 }); - db.addMatchStat(String(pid), m.id); + // Alleen voor ranked matches + if (m.match_type === 'ranked') { + for (const pid of score.team1) { + const p = db.getPlayer(String(pid)); + if (p && !db.hasMatchStat(String(pid), m.id)) { + db.updatePlayer(String(pid), { wins: (p.wins || 0) + 1, games: (p.games || 0) + 1 }); + db.addMatchStat(String(pid), m.id); + } } - } - for (const pid of score.team2) { - const p = db.getPlayer(String(pid)); - if (p && !db.hasMatchStat(String(pid), m.id)) { - db.updatePlayer(String(pid), { games: (p.games || 0) + 1 }); - db.addMatchStat(String(pid), m.id); + for (const pid of score.team2) { + const p = db.getPlayer(String(pid)); + if (p && !db.hasMatchStat(String(pid), m.id)) { + db.updatePlayer(String(pid), { games: (p.games || 0) + 1 }); + db.addMatchStat(String(pid), m.id); + } } + } else { + score.status = hasOpponentConfirm ? "confirmed" : "partial"; } - } else { - score.status = hasOpponentConfirm ? "confirmed" : "partial"; } db.updateMatch(String(req.params.id), { score });