Repository: PokemonGoF/PokemonGo-Bot

Issue:
"release" "any": {"keep_best_iv": 1}, not working properly
1. Have you validated that your config.json is valid JSON? Use http://jsonlint.com/ to check.
   YES
2. Have you [searched our issue tracker](https://github.com/PokemonGoF/PokemonGo-Bot/issues?q=is%3Aissue+sort%3Aupdated-desc) to see if the issue already exists? If so, comment on that issue instead rather than creating a new issue.
   YES
3. Are you running on the `master` branch? We work on the `dev` branch and then add that functionality to `master` when it is stable. Your issue may be fixed on `dev` and there is no need for this issue, just wait and it will eventually be merged to `master`.
   DEV
### Expected Behavior

Got every Pokemon with best IV
### Actual Behavior

Got some 10x this same Pokemons.
### Your FULL config.json (remove your username, password, gmapkey and any other private info)

http://www.wklej.org/hash/b14ba84bc91/
### Output when issue occurred

2016-08-23 16:30:06,007 [PokemonGoBot] [INFO] #16 Pidgey: (CP 10, IV 0.53) | (CP 112, IV 0.56) | (CP 142, IV 0.4) | (CP 111, IV 0.51) | (CP 144, IV 0.44) | (CP 110, IV 0.49) | (CP 73, IV 0.33) | (CP 90, IV 0.38) | (CP 57, IV 0.29) | (CP 189, IV 0.67) | (CP 10, IV 0.29) | (CP 59, IV 0.44) | (CP 91, IV 0.4) | (CP 24, IV 0.33) | (CP 131, IV 0.09) | (CP 78, IV 0.56) | (CP 26, IV 0.62) | (CP 78, IV 0.4) | (CP 56, IV 0.2) | (CP 10, IV 0.47) | (CP 23, IV 0.24) | (CP 10, IV 0.4) | (CP 72, IV 0.29) | (CP 162, IV 0.47) | (CP 25, IV 0.53) | (CP 23, IV 0.24) | (CP 53, IV 0.09) | (CP 112, IV 0.6) | (CP 75, IV 0.38) | (CP 58, IV 0.47) | (CP 88, IV 0.31) | (CP 60, IV 0.53) | (CP 39, IV 0.16) | (CP 10, IV 0.29) | (CP 57, IV 0.36) | (CP 90, IV 0.36) | (CP 10, IV 0.6) | (CP 109, IV 0.42) | (CP 95, IV 0.56) | (CP 124, IV 0.38) | (CP 145, IV 0.07) | (CP 68, IV 0.09) | (CP 56, IV 0.24) | (CP 73, IV 0.38)
### Steps to Reproduce

run a bot and get info about pokemons in bag
### Other Information

OS: Debian SID
Branch: DEV
Git Commit: 382a406cccfa68c96c576c6f1d4f3ea9d81deb7d
Python Version: 2.9.7

"release" "any": {"keep_best_iv": 1}, not working properly
1. Have you validated that your config.json is valid JSON? Use http://jsonlint.com/ to check.
   YES
2. Have you [searched our issue tracker](https://github.com/PokemonGoF/PokemonGo-Bot/issues?q=is%3Aissue+sort%3Aupdated-desc) to see if the issue already exists? If so, comment on that issue instead rather than creating a new issue.
   YES
3. Are you running on the `master` branch? We work on the `dev` branch and then add that functionality to `master` when it is stable. Your issue may be fixed on `dev` and there is no need for this issue, just wait and it will eventually be merged to `master`.
   DEV
### Expected Behavior

Got every Pokemon with best IV
### Actual Behavior

Got some 10x this same Pokemons.
### Your FULL config.json (remove your username, password, gmapkey and any other private info)

http://www.wklej.org/hash/b14ba84bc91/
### Output when issue occurred

2016-08-23 16:30:06,007 [PokemonGoBot] [INFO] #16 Pidgey: (CP 10, IV 0.53) | (CP 112, IV 0.56) | (CP 142, IV 0.4) | (CP 111, IV 0.51) | (CP 144, IV 0.44) | (CP 110, IV 0.49) | (CP 73, IV 0.33) | (CP 90, IV 0.38) | (CP 57, IV 0.29) | (CP 189, IV 0.67) | (CP 10, IV 0.29) | (CP 59, IV 0.44) | (CP 91, IV 0.4) | (CP 24, IV 0.33) | (CP 131, IV 0.09) | (CP 78, IV 0.56) | (CP 26, IV 0.62) | (CP 78, IV 0.4) | (CP 56, IV 0.2) | (CP 10, IV 0.47) | (CP 23, IV 0.24) | (CP 10, IV 0.4) | (CP 72, IV 0.29) | (CP 162, IV 0.47) | (CP 25, IV 0.53) | (CP 23, IV 0.24) | (CP 53, IV 0.09) | (CP 112, IV 0.6) | (CP 75, IV 0.38) | (CP 58, IV 0.47) | (CP 88, IV 0.31) | (CP 60, IV 0.53) | (CP 39, IV 0.16) | (CP 10, IV 0.29) | (CP 57, IV 0.36) | (CP 90, IV 0.36) | (CP 10, IV 0.6) | (CP 109, IV 0.42) | (CP 95, IV 0.56) | (CP 124, IV 0.38) | (CP 145, IV 0.07) | (CP 68, IV 0.09) | (CP 56, IV 0.24) | (CP 73, IV 0.38)
### Steps to Reproduce

run a bot and get info about pokemons in bag
### Other Information

OS: Debian SID
Branch: DEV
Git Commit: 382a406cccfa68c96c576c6f1d4f3ea9d81deb7d
Python Version: 2.9.7



Discussion:

Resolving patch:
diff --git a/pokemongo_bot/cell_workers/transfer_pokemon.py b/pokemongo_bot/cell_workers/transfer_pokemon.py
--- a/pokemongo_bot/cell_workers/transfer_pokemon.py
+++ b/pokemongo_bot/cell_workers/transfer_pokemon.py
@@ -29,9 +29,10 @@ def work(self):
             pokemon_name = Pokemons.name_for(pokemon_id)
             self._release_pokemon_worst_in_group(group, pokemon_name)
 
-        group = [p for p in inventory.pokemons().all()
-                 if p.in_fort is False and p.is_favorite is False]
-        self._release_pokemon_worst_in_group(group, 'all')
+        if self.bot.config.release.get('all'):
+            group = [p for p in inventory.pokemons().all()
+                     if p.in_fort is False and p.is_favorite is False]
+            self._release_pokemon_worst_in_group(group, 'all')
 
     def _should_work(self):
         return inventory.Pokemons.get_space_left() <= self.min_free_slot


Test patch: