about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-09-24 11:33:55 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-09-24 11:33:55 -0400
commit1ecba46a8cb0db962908f47ab4e054ee04804a4a (patch)
treec47b8a00967411a708d3021f46d9b4cf63d6fdfe
parent2405727d7d62fce31102520167cde42ee688c198 (diff)
downloadpokeviewer-1ecba46a8cb0db962908f47ab4e054ee04804a4a.tar.gz
pokeviewer-1ecba46a8cb0db962908f47ab4e054ee04804a4a.tar.bz2
pokeviewer-1ecba46a8cb0db962908f47ab4e054ee04804a4a.zip
Added OT gender field
-rw-r--r--app/jobs/pokeviewer/extract_save_data_job.rb1
-rw-r--r--app/models/pokeviewer/pokemon.rb3
-rw-r--r--app/views/pokeviewer/pokemon/show.html.haml2
-rw-r--r--db/migrate/20170924152817_add_ot_gender_to_pokemon.rb5
-rw-r--r--test/dummy/db/schema.rb3
5 files changed, 12 insertions, 2 deletions
diff --git a/app/jobs/pokeviewer/extract_save_data_job.rb b/app/jobs/pokeviewer/extract_save_data_job.rb index e4f3ae2..0a9b790 100644 --- a/app/jobs/pokeviewer/extract_save_data_job.rb +++ b/app/jobs/pokeviewer/extract_save_data_job.rb
@@ -27,6 +27,7 @@ module Pokeviewer
27 r.species_id = param["species"] 27 r.species_id = param["species"]
28 r.ot_name = param["otName"] 28 r.ot_name = param["otName"]
29 r.ot_number = param["otId"] 29 r.ot_number = param["otId"]
30 r.ot_gender = param["otGender"]
30 31
31 if param["metLevel"] == 0 32 if param["metLevel"] == 0
32 r.met_type = :hatched 33 r.met_type = :hatched
diff --git a/app/models/pokeviewer/pokemon.rb b/app/models/pokeviewer/pokemon.rb index 1410d37..1e3bfc8 100644 --- a/app/models/pokeviewer/pokemon.rb +++ b/app/models/pokeviewer/pokemon.rb
@@ -14,6 +14,9 @@ module Pokeviewer
14 validates :ot_number, presence: true, 14 validates :ot_number, presence: true,
15 numericality: { greater_than_or_equal_to: 0, only_integer: true } 15 numericality: { greater_than_or_equal_to: 0, only_integer: true }
16 16
17 validates :ot_gender, presence: true
18 enumerize :ot_gender, in: [:female, :male]
19
17 validates :met_level, presence: true, 20 validates :met_level, presence: true,
18 numericality: { greater_than_or_equal_to: 1, only_integer: true }, 21 numericality: { greater_than_or_equal_to: 1, only_integer: true },
19 if: Proc.new { |a| a.met_type == :normal } 22 if: Proc.new { |a| a.met_type == :normal }
diff --git a/app/views/pokeviewer/pokemon/show.html.haml b/app/views/pokeviewer/pokemon/show.html.haml index b61917c..a38d641 100644 --- a/app/views/pokeviewer/pokemon/show.html.haml +++ b/app/views/pokeviewer/pokemon/show.html.haml
@@ -6,7 +6,7 @@
6 .pokemon-name= @pokemon.revisions.last.nickname 6 .pokemon-name= @pokemon.revisions.last.nickname
7 .pokemon-ot 7 .pokemon-ot
8 OT/ 8 OT/
9 %span{ class: @pokemon.gender }>= @pokemon.ot_name 9 %span{ class: @pokemon.ot_gender }>= @pokemon.ot_name
10 .pokemon-id= "ID/#{@pokemon.ot_number}" 10 .pokemon-id= "ID/#{@pokemon.ot_number}"
11 .pokemon-level= "Lv. #{@pokemon.revisions.last.level}" 11 .pokemon-level= "Lv. #{@pokemon.revisions.last.level}"
12 %table.pokemon-ivs 12 %table.pokemon-ivs
diff --git a/db/migrate/20170924152817_add_ot_gender_to_pokemon.rb b/db/migrate/20170924152817_add_ot_gender_to_pokemon.rb new file mode 100644 index 0000000..b5f715c --- /dev/null +++ b/db/migrate/20170924152817_add_ot_gender_to_pokemon.rb
@@ -0,0 +1,5 @@
1class AddOtGenderToPokemon < ActiveRecord::Migration[5.1]
2 def change
3 add_column :pokeviewer_pokemon, :ot_gender, :string, null: false, default: ""
4 end
5end
diff --git a/test/dummy/db/schema.rb b/test/dummy/db/schema.rb index 1ce4679..9d6d773 100644 --- a/test/dummy/db/schema.rb +++ b/test/dummy/db/schema.rb
@@ -10,7 +10,7 @@
10# 10#
11# It's strongly recommended that you check this file into your version control system. 11# It's strongly recommended that you check this file into your version control system.
12 12
13ActiveRecord::Schema.define(version: 20170924035127) do 13ActiveRecord::Schema.define(version: 20170924152817) do
14 14
15 create_table "pokeviewer_moves", force: :cascade do |t| 15 create_table "pokeviewer_moves", force: :cascade do |t|
16 t.string "name", limit: 191, null: false 16 t.string "name", limit: 191, null: false
@@ -37,6 +37,7 @@ ActiveRecord::Schema.define(version: 20170924035127) do
37 t.string "unown_letter", limit: 1 37 t.string "unown_letter", limit: 1
38 t.datetime "created_at", null: false 38 t.datetime "created_at", null: false
39 t.datetime "updated_at", null: false 39 t.datetime "updated_at", null: false
40 t.string "ot_gender", default: "", null: false
40 t.index ["key"], name: "index_pokeviewer_pokemon_on_key", unique: true 41 t.index ["key"], name: "index_pokeviewer_pokemon_on_key", unique: true
41 t.index ["species_id"], name: "index_pokeviewer_pokemon_on_species_id" 42 t.index ["species_id"], name: "index_pokeviewer_pokemon_on_species_id"
42 t.index ["trainer_id"], name: "index_pokeviewer_pokemon_on_trainer_id" 43 t.index ["trainer_id"], name: "index_pokeviewer_pokemon_on_trainer_id"