fix: missing brace in ranked score block

This commit is contained in:
root
2026-05-25 09:44:34 +00:00
parent d192a02cc5
commit c0b33c2144
+16 -13
View File
@@ -439,22 +439,25 @@ app.post("/api/matches/:id/verify", (req, res) => {
score.confirmed_at = new Date().toISOString(); score.confirmed_at = new Date().toISOString();
// Update player wins/losses (idempotent via player_match_stats tabel) // Update player wins/losses (idempotent via player_match_stats tabel)
for (const pid of score.team1) { // Alleen voor ranked matches
const p = db.getPlayer(String(pid)); if (m.match_type === 'ranked') {
if (p && !db.hasMatchStat(String(pid), m.id)) { for (const pid of score.team1) {
db.updatePlayer(String(pid), { wins: (p.wins || 0) + 1, games: (p.games || 0) + 1 }); const p = db.getPlayer(String(pid));
db.addMatchStat(String(pid), m.id); 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) {
for (const pid of score.team2) { const p = db.getPlayer(String(pid));
const p = db.getPlayer(String(pid)); if (p && !db.hasMatchStat(String(pid), m.id)) {
if (p && !db.hasMatchStat(String(pid), m.id)) { db.updatePlayer(String(pid), { games: (p.games || 0) + 1 });
db.updatePlayer(String(pid), { games: (p.games || 0) + 1 }); db.addMatchStat(String(pid), m.id);
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 }); db.updateMatch(String(req.params.id), { score });