Pokeapi: Wurmple evolution incorrect.

Created on 18 Apr 2016  路  16Comments  路  Source: PokeAPI/pokeapi

http://pokeapi.co/api/v2/evolution-chain/135/

The Wurmple evolution isn't correct. The "Cascoon" to "Dustox" are out of place. As it is in the current api, the Cascoon object is on the same level as Beautifly. The (simplified) correct evolution is below.

Wurmple evolves_to: [
Silcoon evolves_to: Beautifly,
Cascoon evolves_to: Dustox
]

bug veekun

Most helpful comment

Hey, you caught a bug! Nice work!

All 16 comments

Hey, you caught a bug! Nice work!

@tbone849 good spot. We're going to have to dive into the live database and figure that out!

Thanks!

@tbone849 @phalt This is my dumb. It definitely has something to do with the build_chain function in the EvolutionChainDetail Serializer. See below. At first glance I believe it would be the lines where we check
# In case this pokemon is one of multiple evolutions a pokemon can make

I clearly made a false assumption that pokemon appeard in an order something like
255: wurmple
256: silcoon
257: cascoon
258: beautifly
259: dustox

when in reality it's
255: wurmple
256: silcoon
257: beautifly
258: cascoon
259: dustox

Unfortunately, the wurmple line is the only evolution chain that breaks my assumption (sadface) because its the only chain that has two stage 1 pokemon that further evolve into different stage 2s.

I may be able to rewrite this soon but It would also be a good place for someone else to jump in and get intimate with the code :)

DO IT FOR WURMPLE!
image

pokemon_v2/serializers.py starting at line 2823

class EvolutionChainDetailSerializer(serializers.ModelSerializer):

    baby_trigger_item = ItemSummarySerializer()
    chain = serializers.SerializerMethodField('build_chain')

    class Meta:
        model = EvolutionChain
        fields = (
            'id',
            'baby_trigger_item',
            'chain'
        )

    def build_chain(self, obj):

        chain_id = obj.id

        pokemon_objects = PokemonSpecies.objects.filter(
            evolution_chain_id=chain_id).order_by('order')
        summary_data = PokemonSpeciesSummarySerializer(
            pokemon_objects, many=True, context=self.context).data
        ref_data = PokemonSpeciesEvolutionSerializer(
            pokemon_objects, many=True, context=self.context).data

        chain = entry = OrderedDict()
        current_evolutions = None
        evolution_data = None
        previous_entry = None
        previous_species = None

        for index, species in enumerate(ref_data):

            # If evolves from something
            if species['evolves_from_species']:

                # In case this pokemon is one of multiple evolutions a pokemon can make
                if previous_species:
                    if previous_species['id'] == species['evolves_from_species']:
                        current_evolutions = previous_entry['evolves_to']

                entry = OrderedDict()

                many = False
                try:
                    evolution_object = PokemonEvolution.objects.get(evolved_species=species['id'])
                except PokemonEvolution.MultipleObjectsReturned:
                    evolution_object = PokemonEvolution.objects.filter(
                        evolved_species=species['id'])
                    many = True

                evolution_data = PokemonEvolutionSerializer(
                    evolution_object, many=many, context=self.context).data

                current_evolutions.append(entry)

            entry['is_baby'] = species['is_baby']
            entry['species'] = summary_data[index]
            entry['evolution_details'] = evolution_data or None
            entry['evolves_to'] = []

            # Keep track of previous entries for complex chaining
            previous_entry = entry
            previous_species = species

        return chain

Hi folks ! Any idea when this will be fixed ?

I was planning to take a look a few weeks ago but school interfered. If it's still open during my break next month I may try it.

I see that this issue was closed on June 12 but as of this writing Silcoon is still the only 2nd evolution of Wurmple in the database (Cascoon is still buried within Silcoon's evolution data). Any thoughts about when this might actually be resolved? Thanks!

All the open issues were closed three months ago when PokeAPI was about to shut down, but that decision was then reversed. It might be worth someone with the proper privs reopening this issue - as well as most of the other recently closed ones?

I don't currently have the time to look at this, but I'll go ahead and reopen for visibility.

This bug still exists and it's making me sad.

https://pokeapi.co/api/v2/evolution-chain/135/

@Naramsim According to #307, this should've been fixed by the merge of #305. Do you know if there's anything else we need to do?

Yeah, I hoped that Veekun had updated the entries in their CSVs, but they didn't.

We could modify by ourselves the CSV files, remembering to change them every time we pull from Veekun in order to not overwrite the evolution chain with wrong data.

Ah :(
Is it https://github.com/veekun/pokedex that we get the data from? If so I suppose we should log an issue there?

@Naramsim :) would be better to modify CSV and PR it so it is not done many times:) well anyways, you are doing a great deal of good work, thanks!

@LukaszGrela I'll be honest. Even if we do this change, you will not see anything because we don't have the possibility to push the new code on the server.

We also have a PR for new pokemons and stuff, but Phalt needs to approve it (this is his project)

Well, catch 22 I guess. Can't this dependency be somehow cut? For the Pokeapi consumer it is not veekun pokedex broken but Pokeapi. Thanks for response anyway.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seelker picture seelker  路  4Comments

cmmartti picture cmmartti  路  4Comments

nnguy152 picture nnguy152  路  5Comments

fleeting picture fleeting  路  5Comments

zaneadix picture zaneadix  路  6Comments