From 6ebea65a934685b2bb6fe63fdd4d8c4b29abcdec Mon Sep 17 00:00:00 2001 From: Kevin Rode Date: Mon, 4 Jan 2021 22:39:58 -0500 Subject: [PATCH] Reverting fuzzy select --- database.py | 2 +- the_prestige.py | 18 +++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/database.py b/database.py index 4c71023..831c496 100644 --- a/database.py +++ b/database.py @@ -292,7 +292,7 @@ def search_teams(search_string): conn = create_connection() if conn is not None: c = conn.cursor() - c.execute("SELECT team_json_string FROM teams WHERE name LIKE ?",(re.sub('[^A-Za-z0-9 %]+', '', f"%{search_string}%"),)) + c.execute("SELECT team_json_string FROM teams WHERE name LIKE ?",(f"%{search_string}%"),) team_json_strings = c.fetchall() conn.close() return team_json_strings diff --git a/the_prestige.py b/the_prestige.py index 1070699..a175fa5 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -135,22 +135,14 @@ class StartGameCommand(Command): innings = None try: - team_name1 = command.split("\n")[1].strip() - team1 = get_team_fuzzy_search(team_name1) - print(team_name1) - - team_name2 = command.split("\n")[2].strip() - team2 = get_team_fuzzy_search(team_name2) - print(team_name2) - + team1 = games.get_team(command.split("\n")[1]) + team2 = games.get_team(command.split("\n")[2]) innings = int(command.split("\n")[3]) except IndexError: try: - team_name1 = command.split("\n")[1].strip() - team1 = get_team_fuzzy_search(team_name1) - - team_name2 = command.split("\n")[2].strip() - team2 = get_team_fuzzy_search(team_name2) + team1 = games.get_team(command.split("\n")[1]) + team2 = games.get_team(command.split("\n")[2]) + innings = None except IndexError: await msg.channel.send("We need at least three lines: startgame, away team, and home team are required. Optionally, the number of innings can go at the end, if you want a change of pace.") return