From aedf4a10083ee5cb62358ac6a326b691f8eb270f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sat, 30 Dec 2023 22:00:20 +0100 Subject: [PATCH] Fix: evaluate k-factor per rating type correctly For a low number of games (K=20 for default config), the K-factor is higher than usual. This was evaluated globally and not per rating type as it should be. This commit introduces counting the number of played games per rating type now, leading to K-factors which are independ across rating types --- src/ratings.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ratings.py b/src/ratings.py index 1cd64d4..9a2f88c 100644 --- a/src/ratings.py +++ b/src/ratings.py @@ -167,6 +167,7 @@ def process_rating_of_next_game() -> bool: "FROM game_participants " "INNER JOIN games " " ON games.id = game_participants.game_id " + "INNER JOIN variants ON games.variant_id = variants.id " "WHERE user_id IN" " (" " SELECT game_participants.user_id FROM games " @@ -175,8 +176,9 @@ def process_rating_of_next_game() -> bool: " WHERE games.id = %s" " )" "AND league_id <= %s " + "AND rating_type = %s " "GROUP BY user_id", - (game_id, league_id) + (game_id, league_id, rating_type) ) games_played = {} for (user_id, num_games) in cur.fetchall():