From bf528b06d2f959b28baf3646f9ada8c0d457ebfe Mon Sep 17 00:00:00 2001 From: Matchu Date: Sat, 27 Apr 2013 10:21:51 -0500 Subject: [PATCH] label pet states as glitched, send to bottom of emotion order --- app/models/pet_state.rb | 13 ++++++++----- config/locales/en-MEEP.yml | 1 + config/locales/en.yml | 1 + .../20130427151327_add_glitched_to_pet_states.rb | 5 +++++ db/schema.rb | 7 +++++-- 5 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 db/migrate/20130427151327_add_glitched_to_pet_states.rb diff --git a/app/models/pet_state.rb b/app/models/pet_state.rb index 37427a50..859d7b19 100644 --- a/app/models/pet_state.rb +++ b/app/models/pet_state.rb @@ -14,9 +14,10 @@ class PetState < ActiveRecord::Base attr_writer :parent_swf_asset_relationships_to_update - # Our ideal order is: happy, sad, sick, UC, any+effects, with male before - # female within those groups for consistency. We therefore order as follows, - # listed in order of priority: + # Our ideal order is: happy, sad, sick, UC, any+effects, glitched, with male + # before female within those groups for consistency. We therefore order as + # follows, listed in order of priority: + # * Send glitched states to the back # * Bring known happy states to the front (we don't want to sort by mood_id # DESC first because then labeled sad will appear before unlabeled happy) # * Send states with effect assets to the back @@ -34,7 +35,7 @@ class PetState < ActiveRecord::Base scope :emotion_order, joins(:parent_swf_asset_relationships). joins("LEFT JOIN swf_assets effect_assets ON effect_assets.id = parents_swf_assets.swf_asset_id AND effect_assets.zone_id = #{bio_effect_zone_id}"). group("pet_states.id"). - order("(mood_id = 1) DESC, COUNT(effect_assets.remote_id) ASC, COUNT(parents_swf_assets.swf_asset_id) DESC, female ASC, SUM(parents_swf_assets.swf_asset_id) ASC") + order("glitched ASC, (mood_id = 1) DESC, COUNT(effect_assets.remote_id) ASC, COUNT(parents_swf_assets.swf_asset_id) DESC, female ASC, SUM(parents_swf_assets.swf_asset_id) ASC") def as_json(options={}) serializable_hash :only => [:id], :methods => [:gender_mood_description] @@ -122,7 +123,9 @@ class PetState < ActiveRecord::Base end def gender_mood_description - if unconverted? + if glitched? + I18n.translate('pet_states.description.glitched') + elsif unconverted? I18n.translate('pet_states.description.unconverted') elsif labeled? I18n.translate('pet_states.description.main', :gender => gender_name, diff --git a/config/locales/en-MEEP.yml b/config/locales/en-MEEP.yml index aa30af33..101c7d19 100644 --- a/config/locales/en-MEEP.yml +++ b/config/locales/en-MEEP.yml @@ -673,6 +673,7 @@ en-MEEP: happy: ":)" sad: ":(" sick: "X(" + glitched: "#!@?!?" unconverted: Unconveeped unlabeled: Unleeped diff --git a/config/locales/en.yml b/config/locales/en.yml index bb826311..791c9f03 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -725,6 +725,7 @@ en: happy: Happy sad: Sad sick: Sick + glitched: Glitched unconverted: Unconverted unlabeled: Unlabeled diff --git a/db/migrate/20130427151327_add_glitched_to_pet_states.rb b/db/migrate/20130427151327_add_glitched_to_pet_states.rb new file mode 100644 index 00000000..de44e88e --- /dev/null +++ b/db/migrate/20130427151327_add_glitched_to_pet_states.rb @@ -0,0 +1,5 @@ +class AddGlitchedToPetStates < ActiveRecord::Migration + def change + add_column :pet_states, :glitched, :boolean, null: false, default: false + end +end diff --git a/db/schema.rb b/db/schema.rb index cae47c53..0c8b4ec8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130128065543) do +ActiveRecord::Schema.define(:version => 20130427151327) do create_table "auth_servers", :force => true do |t| t.string "short_name", :limit => 10, :null => false @@ -145,10 +145,12 @@ ActiveRecord::Schema.define(:version => 20130128065543) do t.string "rarity" t.datetime "created_at" t.datetime "updated_at" + t.boolean "temporary", :default => false, :null => false end add_index "item_translations", ["item_id"], :name => "index_item_translations_on_item_id" add_index "item_translations", ["locale"], :name => "index_item_translations_on_locale" + add_index "item_translations", ["name"], :name => "index_item_translations_on_name" create_table "items", :force => true do |t| t.text "zones_restrict", :null => false @@ -180,7 +182,7 @@ ActiveRecord::Schema.define(:version => 20130128065543) do create_table "outfit_features", :force => true do |t| t.integer "donation_id" t.integer "outfit_id" - t.boolean "approved" + t.boolean "approved", :default => false, :null => false t.datetime "created_at" t.datetime "updated_at" end @@ -232,6 +234,7 @@ ActiveRecord::Schema.define(:version => 20130128065543) do t.integer "mood_id" t.boolean "unconverted" t.boolean "labeled", :default => false, :null => false + t.boolean "glitched", :default => false, :null => false end add_index "pet_states", ["pet_type_id"], :name => "pet_states_pet_type_id"