Remove unused SwfAsset.fitting_standard_body_ids and support methods

This commit is contained in:
Emi Matchu 2024-02-24 15:16:25 -08:00
parent c25e015b70
commit 7fee4e6e41
2 changed files with 0 additions and 17 deletions

View file

@ -29,15 +29,6 @@ class PetType < ApplicationRecord
color_ids = special_color ? [special_color.id] : Color.basic.select([:id]).map(&:id) color_ids = special_color ? [special_color.id] : Color.basic.select([:id]).map(&:id)
where(color_id: color_ids) where(color_id: color_ids)
end end
def self.standard_body_ids
[].tap do |body_ids|
# TODO: the nil hack is lame :P
special_color_or_basic(nil).group_by(&:species_id).each do |species_id, pet_types|
body_ids.concat(pet_types.map(&:body_id))
end
end
end
def self.random_basic_per_species(species_ids) def self.random_basic_per_species(species_ids)
random_pet_types = [] random_pet_types = []

View file

@ -50,19 +50,11 @@ class SwfAsset < ApplicationRecord
has_many :parent_swf_asset_relationships has_many :parent_swf_asset_relationships
delegate :depth, :to => :zone delegate :depth, :to => :zone
def self.body_ids_fitting_standard
@body_ids_fitting_standard ||= PetType.standard_body_ids + [0]
end
scope :fitting_body_id, ->(body_id) { scope :fitting_body_id, ->(body_id) {
where(arel_table[:body_id].in([body_id, 0])) where(arel_table[:body_id].in([body_id, 0]))
} }
scope :fitting_standard_body_ids, -> {
where(arel_table[:body_id].in(body_ids_fitting_standard))
}
scope :fitting_color, ->(color) { scope :fitting_color, ->(color) {
body_ids = PetType.select(:body_id).where(:color_id => color.id).map(&:body_id) body_ids = PetType.select(:body_id).where(:color_id => color.id).map(&:body_id)
body_ids << 0 body_ids << 0