-
Mahmoud Aglan authored
No completed match in production has ever had white_rating_after or rating_change_white written, and 272 of the 290 profiles were still sitting on the default 1200. The complete_match database function does not touch the rating columns, and game.php had calculateElo() and getRatingColumn() helpers that nothing ever called. Elo is now computed in applyRatings(), called from finaliseMatch() after its conditional write has succeeded — so a game can never be rated twice. It writes both ratings before and after and the deltas onto the match, updates the correct per-time-control column on each profile along with the game/win/loss/draw and streak counters, and records a rating_history row per player. This matters beyond the leaderboard: Swiss seeding orders players by rating, so with every rating pinned at 1200 the top-half/bottom-half split in round 1 was arbitrary. Bot games and aborted games are never rated, and a match with the same player on both sides is refused outright. Covered by e2e sections 18 and 19. Co-Authored-By:Claude Opus 5 (1M context) <noreply@anthropic.com>
34f9459c