From 7e4b9ea0c23eb660ab36a6114a7a3046d8f1c5f6 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 13 Jan 2018 16:01:51 -0500 Subject: Moved species from Pokémon to revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The migration will set all of the revisions of each Pokémon to have the species that that Pokémon was set to. If reversed, the migration sets the Pokémon's species to the first revision's species, which mimics the behavior of the engine from before this change, but do note that running the migration backwards like this can lose data. This change slightly affects the loading time of the front page. See #2. refs #3 --- app/jobs/pokeviewer/extract_save_data_job.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/jobs') diff --git a/app/jobs/pokeviewer/extract_save_data_job.rb b/app/jobs/pokeviewer/extract_save_data_job.rb index e9e0231..d1968af 100644 --- a/app/jobs/pokeviewer/extract_save_data_job.rb +++ b/app/jobs/pokeviewer/extract_save_data_job.rb @@ -71,7 +71,6 @@ module Pokeviewer args["pokemon"].each do |param| pk = Pokemon.find_or_create_by!(key: param["key"]) do |r| - r.species_id = param["species"] r.ot_name = param["otName"] r.ot_number = param["otId"] r.ot_gender = param["otGender"] @@ -99,7 +98,7 @@ module Pokeviewer r.pokeball = Pokemon.pokeball.values[param["pokeball"] - 1] # Handle Unown form - if r.species_id == 201 + if param["species"] == 201 r.unown_letter = Pokemon.unown_letter.values[param["unownLetter"]] end end @@ -117,6 +116,7 @@ module Pokeviewer pk.save! rev = Revision.new(pokemon: pk) + rev.species_id = param["species"] rev.nickname = param["nickname"] rev.experience = param["experience"] rev.level = param["level"] -- cgit 1.4.1