Skip to content

Conversation

@loren-jiang
Copy link

Added player search feature using Leveshstein distance.

@amosbastian amosbastian self-assigned this Aug 3, 2020
@amosbastian
Copy link
Owner

Thanks for the PR 😄 I will be able to review this as soon as I get back from holiday.

Copy link
Owner

@amosbastian amosbastian left a 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()
Copy link
Owner

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 = {}
Copy link
Owner

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
Copy link
Owner

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.

Comment on lines +321 to +322
ed = min(levenshtein_distance(full_name, player_name),
levenshtein_distance(web_name, player_name))
Copy link
Owner

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()
Copy link
Owner

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()


async def test_get_gameweek_history_unknown_gameweek_cached(
self, loop, user):
print(user)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants