sort unconverted to the end, too
This commit is contained in:
parent
99a23fc2cb
commit
714f2fddf5
1 changed files with 4 additions and 2 deletions
|
@ -13,8 +13,10 @@ class PetState < ActiveRecord::Base
|
||||||
alias_method :swf_asset_ids_from_association, :swf_asset_ids
|
alias_method :swf_asset_ids_from_association, :swf_asset_ids
|
||||||
|
|
||||||
bio_effect_zone_id = 4
|
bio_effect_zone_id = 4
|
||||||
scope :emotion_order, joins(:parent_swf_asset_relationships => :biology_asset).
|
scope :emotion_order, joins(:parent_swf_asset_relationships).
|
||||||
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")
|
joins("LEFT JOIN swf_assets effect_assets ON effect_assets.id = parents_swf_assets.swf_asset_id AND effect_assets.type = 'biology' AND effect_assets.zone_id = #{bio_effect_zone_id}").
|
||||||
|
group("pet_states.id").
|
||||||
|
order("COUNT(effect_assets.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)
|
def reassign_children_to!(main_pet_state)
|
||||||
self.contributions.each do |contribution|
|
self.contributions.each do |contribution|
|
||||||
|
|
Loading…
Reference in a new issue