From 1ecba46a8cb0db962908f47ab4e054ee04804a4a Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 24 Sep 2017 11:33:55 -0400 Subject: Added OT gender field --- app/jobs/pokeviewer/extract_save_data_job.rb | 1 + app/models/pokeviewer/pokemon.rb | 3 +++ app/views/pokeviewer/pokemon/show.html.haml | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'app') 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 r.species_id = param["species"] r.ot_name = param["otName"] r.ot_number = param["otId"] + r.ot_gender = param["otGender"] if param["metLevel"] == 0 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 validates :ot_number, presence: true, numericality: { greater_than_or_equal_to: 0, only_integer: true } + validates :ot_gender, presence: true + enumerize :ot_gender, in: [:female, :male] + validates :met_level, presence: true, numericality: { greater_than_or_equal_to: 1, only_integer: true }, 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 @@ .pokemon-name= @pokemon.revisions.last.nickname .pokemon-ot OT/ - %span{ class: @pokemon.gender }>= @pokemon.ot_name + %span{ class: @pokemon.ot_gender }>= @pokemon.ot_name .pokemon-id= "ID/#{@pokemon.ot_number}" .pokemon-level= "Lv. #{@pokemon.revisions.last.level}" %table.pokemon-ivs -- cgit 1.4.1