From a863748f5237457961cf67b91e85179a14d63058 Mon Sep 17 00:00:00 2001 From: Raz Date: Tue, 3 Dec 2024 23:16:09 +0100 Subject: [PATCH] fix registration issues --- tournaments/utils/player_search.py | 36 ++++++++++++++++-------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/tournaments/utils/player_search.py b/tournaments/utils/player_search.py index 0a07adb..0f766ef 100644 --- a/tournaments/utils/player_search.py +++ b/tournaments/utils/player_search.py @@ -64,23 +64,25 @@ def get_player_name_from_csv(category, licence_id, base_folder=None): reader = csv.reader(file, delimiter=';') rows = list(reader) # Read all rows at once to process later - for row in rows: - if len(row) >= 15: # Ensure row has enough columns - current_licence_id = row[5] - if current_licence_id == str(cleaned_licence_id): - data = { - "first_name": row[3], # 4th column: first name - "last_name": row[2], # 3rd column: last name - "rank": row[1], - "points": row[6], - "assimilation": row[7], - "tournament_count": row[8], - "ligue_name": row[9], - "club_name": row[11], - "birth_year": row[14], - "is_woman": is_woman, - } - return data, True + + if cleaned_licence_id: + for row in rows: + if len(row) >= 15: # Ensure row has enough columns + current_licence_id = row[5] + if current_licence_id == str(cleaned_licence_id): + data = { + "first_name": row[3], # 4th column: first name + "last_name": row[2], # 3rd column: last name + "rank": row[1], + "points": row[6], + "assimilation": row[7], + "tournament_count": row[8], + "ligue_name": row[9], + "club_name": row[11], + "birth_year": row[14], + "is_woman": is_woman, + } + return data, True # Determine the rank for an unranked player if rows: