sort effects to the end of the gender/emotion list
This commit is contained in:
parent
74482dbf75
commit
99a23fc2cb
2 changed files with 17 additions and 15 deletions
|
@ -12,8 +12,9 @@ class PetState < ActiveRecord::Base
|
|||
|
||||
alias_method :swf_asset_ids_from_association, :swf_asset_ids
|
||||
|
||||
scope :emotion_order, joins(:parent_swf_asset_relationships).
|
||||
group("pet_states.id").order("COUNT(parents_swf_assets.swf_asset_id) DESC, SUM(parents_swf_assets.swf_asset_id) ASC")
|
||||
bio_effect_zone_id = 4
|
||||
scope :emotion_order, joins(:parent_swf_asset_relationships => :biology_asset).
|
||||
group("pet_states.id").order("COUNT(swf_assets.zone_id = #{bio_effect_zone_id}) ASC, COUNT(parents_swf_assets.swf_asset_id) DESC, SUM(parents_swf_assets.swf_asset_id) ASC")
|
||||
|
||||
def reassign_children_to!(main_pet_state)
|
||||
self.contributions.each do |contribution|
|
||||
|
@ -124,3 +125,4 @@ class PetState < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class PetType < ActiveRecord::Base
|
|||
|
||||
def as_json(options={})
|
||||
if options[:for] == 'wardrobe'
|
||||
{:id => id, :body_id => body_id, :pet_state_ids => pet_states.select([:id]).emotion_order.map(&:id)}
|
||||
{:id => id, :body_id => body_id, :pet_state_ids => pet_states.select('pet_states.id').emotion_order.map(&:id)}
|
||||
else
|
||||
{:image_hash => image_hash}
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue