label pet states as glitched, send to bottom of emotion order

This commit is contained in:
Emi Matchu 2013-04-27 10:21:51 -05:00
parent edc61e9cb4
commit bf528b06d2
5 changed files with 20 additions and 7 deletions

View file

@ -14,9 +14,10 @@ class PetState < ActiveRecord::Base
attr_writer :parent_swf_asset_relationships_to_update attr_writer :parent_swf_asset_relationships_to_update
# Our ideal order is: happy, sad, sick, UC, any+effects, with male before # Our ideal order is: happy, sad, sick, UC, any+effects, glitched, with male
# female within those groups for consistency. We therefore order as follows, # before female within those groups for consistency. We therefore order as
# listed in order of priority: # 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 # * 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) # DESC first because then labeled sad will appear before unlabeled happy)
# * Send states with effect assets to the back # * Send states with effect assets to the back
@ -34,7 +35,7 @@ class PetState < ActiveRecord::Base
scope :emotion_order, joins(:parent_swf_asset_relationships). 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}"). 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"). 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={}) def as_json(options={})
serializable_hash :only => [:id], :methods => [:gender_mood_description] serializable_hash :only => [:id], :methods => [:gender_mood_description]
@ -122,7 +123,9 @@ class PetState < ActiveRecord::Base
end end
def gender_mood_description def gender_mood_description
if unconverted? if glitched?
I18n.translate('pet_states.description.glitched')
elsif unconverted?
I18n.translate('pet_states.description.unconverted') I18n.translate('pet_states.description.unconverted')
elsif labeled? elsif labeled?
I18n.translate('pet_states.description.main', :gender => gender_name, I18n.translate('pet_states.description.main', :gender => gender_name,

View file

@ -673,6 +673,7 @@ en-MEEP:
happy: ":)" happy: ":)"
sad: ":(" sad: ":("
sick: "X(" sick: "X("
glitched: "#!@?!?"
unconverted: Unconveeped unconverted: Unconveeped
unlabeled: Unleeped unlabeled: Unleeped

View file

@ -725,6 +725,7 @@ en:
happy: Happy happy: Happy
sad: Sad sad: Sad
sick: Sick sick: Sick
glitched: Glitched
unconverted: Unconverted unconverted: Unconverted
unlabeled: Unlabeled unlabeled: Unlabeled

View file

@ -0,0 +1,5 @@
class AddGlitchedToPetStates < ActiveRecord::Migration
def change
add_column :pet_states, :glitched, :boolean, null: false, default: false
end
end

View file

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # 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| create_table "auth_servers", :force => true do |t|
t.string "short_name", :limit => 10, :null => false t.string "short_name", :limit => 10, :null => false
@ -145,10 +145,12 @@ ActiveRecord::Schema.define(:version => 20130128065543) do
t.string "rarity" t.string "rarity"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.boolean "temporary", :default => false, :null => false
end end
add_index "item_translations", ["item_id"], :name => "index_item_translations_on_item_id" 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", ["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| create_table "items", :force => true do |t|
t.text "zones_restrict", :null => false t.text "zones_restrict", :null => false
@ -180,7 +182,7 @@ ActiveRecord::Schema.define(:version => 20130128065543) do
create_table "outfit_features", :force => true do |t| create_table "outfit_features", :force => true do |t|
t.integer "donation_id" t.integer "donation_id"
t.integer "outfit_id" t.integer "outfit_id"
t.boolean "approved" t.boolean "approved", :default => false, :null => false
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
end end
@ -232,6 +234,7 @@ ActiveRecord::Schema.define(:version => 20130128065543) do
t.integer "mood_id" t.integer "mood_id"
t.boolean "unconverted" t.boolean "unconverted"
t.boolean "labeled", :default => false, :null => false t.boolean "labeled", :default => false, :null => false
t.boolean "glitched", :default => false, :null => false
end end
add_index "pet_states", ["pet_type_id"], :name => "pet_states_pet_type_id" add_index "pet_states", ["pet_type_id"], :name => "pet_states_pet_type_id"