forked from Hanabi/hanabi-league
add function to process all games for rating
This commit is contained in:
parent
4d6fedf768
commit
cabec71e4f
1 changed files with 13 additions and 2 deletions
|
@ -118,11 +118,11 @@ def get_current_variant_rating(variant_id: int, num_players: int) -> float:
|
|||
return base_rating
|
||||
|
||||
|
||||
def process_rating_of_next_game():
|
||||
def process_rating_of_next_game() -> bool:
|
||||
game_id = next_game_to_rate()
|
||||
if game_id is None:
|
||||
logger.verbose("All games already processed for rating changes.")
|
||||
return
|
||||
return False
|
||||
logger.verbose("Processing rating for game {}".format(game_id))
|
||||
cur = conn_manager.get_new_cursor()
|
||||
|
||||
|
@ -180,3 +180,14 @@ def process_rating_of_next_game():
|
|||
user_ratings_vals
|
||||
)
|
||||
conn_manager.get_connection().commit()
|
||||
return True
|
||||
|
||||
|
||||
def process_rating_of_all_games():
|
||||
# It might seem a bit tedious of processing every single game separately,
|
||||
# which means reading and writing to the database more than we would strictly need.
|
||||
# However, since we have such a small number of games, this is fast enough without problems,
|
||||
# and makes the program structure easier, therefore avoiding mistakes and improving granularity
|
||||
# of our database updates.
|
||||
while process_rating_of_next_game():
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue