-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implemented search.py and wrote basic tests #86
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR 😄 I will be able to review this as soon as I get back from holiday. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm just need a couple of changes I think. Also unidecode
should be added to install_requires
in setup.py
I think.
|
||
players = getattr(self, "elements") | ||
N = len(players) | ||
search_term = player_name.lower() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't used for anything.
search_term = player_name.lower() | ||
min_id = 0 | ||
min_ed = float('inf') | ||
eds = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is eds
?
players = getattr(self, "elements") | ||
N = len(players) | ||
search_term = player_name.lower() | ||
min_id = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't used for anything.
ed = min(levenshtein_distance(full_name, player_name), | ||
levenshtein_distance(web_name, player_name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess search_term
should be used here?
player_ids = [0]*N | ||
for i, player in enumerate(players.values()): | ||
player_ids[i] = player['id'] | ||
full_name = unidecode(player['first_name'] + ' ' + player['second_name']).lower() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be something like
first_name = unidecode(player["first_name"])
second_name = unidecode(player["second_name"])
full_name = f"{first_name} {second_name}".lower()
@@ -186,6 +186,7 @@ async def test_init(self, loop): | |||
|
|||
async def test_get_gameweek_history_unknown_gameweek_cached( | |||
self, loop, user): | |||
print(user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be removed.
Added player search feature using Leveshstein distance.