From b100b2f49cbe65dcdf57bb9732b8c8a6fb34524d Mon Sep 17 00:00:00 2001 From: Ignacio Date: Fri, 2 Aug 2024 16:45:02 +0200 Subject: [PATCH] ficed bug naitonality 23 --- back/utils.py | 30 ++++++++++++++++++------------ launcher/version.conf | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/back/utils.py b/back/utils.py index 0844bf6f..5181e865 100644 --- a/back/utils.py +++ b/back/utils.py @@ -125,7 +125,7 @@ def fetch_staff(self, game_year): retirement = self.fetch_driverRetirement(id) race_formula = self.fetch_raceFormula(id) team_future = self.fetch_for_future_contract(id) - country_code = self.fetch_nationality(id) + country_code = self.fetch_nationality(id, game_year) if race_formula[0] == None: race_formula = (4,) data_dict = {i: result[i] for i in range(len(result))} @@ -344,7 +344,7 @@ def fetch_info(self, game_year): superlicense = self.fetch_superlicense(id) team_future = self.fetch_for_future_contract(id) driver_code = self.fetch_driverCode(id) - country_code = self.fetch_nationality(id) + country_code = self.fetch_nationality(id, game_year) data_dict = {i: result[i] for i in range(len(result))} data_dict["driver_number"] = driver_number[0] data_dict["wants1"] = driver_number[1] @@ -368,18 +368,24 @@ def fetch_info(self, game_year): return formatted_tuples - def fetch_nationality(self, driverID): - code = self.cursor.execute(f"SELECT CountryID FROM Staff_BasicData WHERE StaffID = {driverID}").fetchone()[0] - nationality = self.cursor.execute(f"SELECT Name FROM Countries WHERE CountryID = {code}").fetchone()[0] - expr = r'(?<=\[Nationality_)[^\]]+' - result = re.search(expr, nationality) - if result: - nat = result.group(0) - nat_name = re.sub(r'(?