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
This commit is contained in:
Maximilian Keßler 2023-12-30 22:00:20 +01:00
parent b16b90e1c1
commit aedf4a1008
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -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():