Fix column indices when building MoveChange from move_changelog.csv - #1669
Conversation
move_changelog.csv columns are: move_id,changed_in_version_group_id,type_id,power,pp,accuracy,priority, target_id,effect_id,effect_chance The build script read info[6]/info[7] (priority/target_id, neither of which MoveChange models) as effect_id/effect_chance instead of the actual info[8]/info[9] columns. This dropped real effect changes (e.g. Double-Edge's recoil effect at gold-silver) and fabricated bogus ones from unrelated numeric values (e.g. Follow Me picked up a false "chance to poison" effect from its priority value of 3, which happens to be move_effect id 3). Fixes PokeAPI#1663
|
Thanks a lot for coming back to this. There was an issue linked, am I right? |
|
A PokeAPI/api-data refresh has started. In ~45 minutes the staging branch of PokeAPI/api-data will be pushed with the new generated data. |
|
The updater script has finished its job and has now opened a Pull Request towards PokeAPI/api-data with the updated data. |
|
Yep, fixes #1663 — linked in the PR description. Thanks for merging! |
Fixes #1663.
Problem
move_changelog.csvcolumns are:The build script's
csv_record_to_objectsforMoveChangereadinfo[6]/info[7](priority/target_id— neither of whichMoveChangeeven has a field for) aseffect_id/effect_chance, instead of the actualinfo[8]/info[9]columns.This both dropped real effect changes and fabricated bogus ones from unrelated numeric values, e.g.:
38,3,,100,,,,,49,— realeffect_idis 49 (recoil), but the old code readinfo[6](emptypriority) → the recoil effect at gold-silver was silently dropped.266,15,,,,,3,,,—effect_idis actually empty, but the old code readinfo[6](priority=3) → it fabricatedmove_effect_id=3, which happens to be "Has a chance to poison the target," giving Follow Me a completely fictitious effect change.Fix
Read
info[8]/info[9]instead ofinfo[6]/info[7].Test plan
There's no existing test coverage for
data/v2/build.py's CSV-import logic, so I verified against the real production CSV data:MoveChange.objects.get(move_id=38, version_group_id=3).move_effect_id→49(recoil), previouslyNone.MoveChange.objects.get(move_id=266, version_group_id=15).move_effect_id→None, previously3(poison).GET /api/v2/move/double-edge/now shows the recoil effect inpast_valuesfor gold-silver;GET /api/v2/move/follow-me/no longer shows the fabricated poison effect.manage.py test pokemon_v2passes (60 tests).pre-commit run --files data/v2/build.pypasses (ruff check, ruff format, ty).