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 });