Reverting fuzzy select

This commit is contained in:
Kevin Rode 2021-01-04 22:39:58 -05:00
parent 14e4b5db6f
commit 6ebea65a93
2 changed files with 6 additions and 14 deletions

View File

@ -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

View File

@ -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