about summary refs log tree commit diff stats
path: root/app/jobs
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-01-13 16:01:51 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-01-13 16:01:51 -0500
commit7e4b9ea0c23eb660ab36a6114a7a3046d8f1c5f6 (patch)
treed2e020ca045ce3d6f28a6d912bbc343db03265d2 /app/jobs
parentd91e1d9a9ee98cc364bc62a4dd156500a189b99a (diff)
downloadpokeviewer-7e4b9ea0c23eb660ab36a6114a7a3046d8f1c5f6.tar.gz
pokeviewer-7e4b9ea0c23eb660ab36a6114a7a3046d8f1c5f6.tar.bz2
pokeviewer-7e4b9ea0c23eb660ab36a6114a7a3046d8f1c5f6.zip
Moved species from Pokémon to revision
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
Diffstat (limited to 'app/jobs')
-rw-r--r--app/jobs/pokeviewer/extract_save_data_job.rb4
1 files changed, 2 insertions, 2 deletions
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
71 71
72 args["pokemon"].each do |param| 72 args["pokemon"].each do |param|
73 pk = Pokemon.find_or_create_by!(key: param["key"]) do |r| 73 pk = Pokemon.find_or_create_by!(key: param["key"]) do |r|
74 r.species_id = param["species"]
75 r.ot_name = param["otName"] 74 r.ot_name = param["otName"]
76 r.ot_number = param["otId"] 75 r.ot_number = param["otId"]
77 r.ot_gender = param["otGender"] 76 r.ot_gender = param["otGender"]
@@ -99,7 +98,7 @@ module Pokeviewer
99 r.pokeball = Pokemon.pokeball.values[param["pokeball"] - 1] 98 r.pokeball = Pokemon.pokeball.values[param["pokeball"] - 1]
100 99
101 # Handle Unown form 100 # Handle Unown form
102 if r.species_id == 201 101 if param["species"] == 201
103 r.unown_letter = Pokemon.unown_letter.values[param["unownLetter"]] 102 r.unown_letter = Pokemon.unown_letter.values[param["unownLetter"]]
104 end 103 end
105 end 104 end
@@ -117,6 +116,7 @@ module Pokeviewer
117 pk.save! 116 pk.save!
118 117
119 rev = Revision.new(pokemon: pk) 118 rev = Revision.new(pokemon: pk)
119 rev.species_id = param["species"]
120 rev.nickname = param["nickname"] 120 rev.nickname = param["nickname"]
121 rev.experience = param["experience"] 121 rev.experience = param["experience"]
122 rev.level = param["level"] 122 rev.level = param["level"]