-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Added further release functionality #1472
Changes from 1 commit
e9be00b
76d122c
8d8cf2c
e6cc405
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,21 +24,31 @@ def work(self): | |
keep_best, keep_best_cp, keep_best_iv = self._validate_keep_best_config(pokemon_name) | ||
|
||
if keep_best: | ||
order_criteria = 'cp' | ||
limit = keep_best_cp | ||
best_pokemon_ids = set() | ||
order_criteria = 'none' | ||
if keep_best_cp >= 1: | ||
cp_limit = keep_best_cp | ||
best_cp_pokemons = sorted(group, key=lambda x: x['cp'], reverse=True)[:cp_limit] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you sort by cp then iv (x['cp'], x['iv'])? if you have pokemon with the same amount of CP #1464 |
||
best_pokemon_ids = set(pokemon['pokemon_data']['id'] for pokemon in best_cp_pokemons) | ||
order_criteria = 'cp' | ||
|
||
if keep_best_iv >= 1: | ||
order_criteria = 'iv' | ||
limit = keep_best_iv | ||
|
||
best_pokemons = sorted(group, key=lambda x: x[order_criteria], reverse=True)[:limit] | ||
iv_limit = keep_best_iv | ||
best_iv_pokemons = sorted(group, key=lambda x: x['iv'], reverse=True)[:iv_limit] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you sort by iv then cp (x['iv'], x['cp'])? if you have pokemon with the same amount of IV #1464 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I will add this. |
||
best_pokemon_ids |= set(pokemon['pokemon_data']['id'] for pokemon in best_iv_pokemons) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not familiar with the operator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://docs.python.org/2/library/sets.html#set-objects it seems to be standard set operator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In this context |
||
if order_criteria == 'cp': | ||
order_criteria = 'cp and iv' | ||
else: | ||
order_criteria = 'iv' | ||
|
||
# remove best pokemons from all pokemons array | ||
all_pokemons = group | ||
for best_pokemon in best_pokemons: | ||
best_pokemons = [] | ||
for best_pokemon_id in best_pokemon_ids: | ||
for pokemon in all_pokemons: | ||
if best_pokemon['pokemon_data']['id'] == pokemon['pokemon_data']['id']: | ||
if best_pokemon_id == pokemon['pokemon_data']['id']: | ||
all_pokemons.remove(pokemon) | ||
best_pokemons.append(pokemon) | ||
|
||
if best_pokemons and all_pokemons: | ||
logger.log("Keep {} best {}, based on {}".format(len(best_pokemons), | ||
|
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 this say
3 strongest
?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.
Changed it to 2.